Skip to content

Instantly share code, notes, and snippets.

@svvitale
Created January 24, 2017 21:36
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 svvitale/7de5b06ba5deacadad456b35038c8c48 to your computer and use it in GitHub Desktop.
Save svvitale/7de5b06ba5deacadad456b35038c8c48 to your computer and use it in GitHub Desktop.
What does this do?
import random
import string
import re
allowable = re.sub(r'[IO10]', '', (string.ascii_uppercase + string.digits))
def combos(place):
for char in allowable:
if place == 1:
yield char
else:
for subchar in combos(place - 1):
yield char + subchar
four_digit_combos = combos(4)
enough_for_1000_people = random.sample(list(four_digit_combos), 1000)
print(enough_for_1000_people)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment