Last active
December 10, 2015 23:59
-
-
Save pcote/4513695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tweaked to make it a little more efficient.