Skip to content

Instantly share code, notes, and snippets.

@pcote
Last active December 10, 2015 23:59
Show Gist options
  • Save pcote/4513695 to your computer and use it in GitHub Desktop.
Save pcote/4513695 to your computer and use it in GitHub Desktop.
# pin_shuffler.py - quick 4 digit pin generator written out of boredom.
# slightly revised
from itertools import permutations
from random import seed, shuffle
from time import time
from operator import concat
from functools import reduce
all_pins = [x for x in permutations(range(10), 4)]
seed(time())
shuffle(all_pins)
pin_choice = all_pins[0]
new_pin = reduce(concat, [str(x) for x in pin_choice])
print("your new pin is: %s" % new_pin)
@pcote
Copy link
Author

pcote commented Jan 15, 2013

Tweaked to make it a little more efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment