Skip to content

Instantly share code, notes, and snippets.

@guyoun
Created October 7, 2015 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guyoun/80ccde51006edb944fca to your computer and use it in GitHub Desktop.
Save guyoun/80ccde51006edb944fca to your computer and use it in GitHub Desktop.
To generate random sequence of letters and digits
import string
import random
print string.ascii_letters
print string.digits
allow_letters = string.ascii_letters + string.digits
print allow_letters
random_string = []
duplicated = 0
for j in range(50000):
s = ''.join(random.choice(allow_letters) for i in range(3))
if s not in random_string:
random_string.append(s)
else:
print 'duplicated'
duplicated = duplicated + 1
print 'end'
print duplicated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment