Last active
January 25, 2019 10:12
-
-
Save ajepe/61315b4cc599fd09ff4f1d7bc4a7b23d to your computer and use it in GitHub Desktop.
my crazy random number and otp
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
''.join([str(random.randint(0, 9)) for _ in range(11)]) | |
def otp(length=5, lowerband=1, upperband=9): | |
return ''.join( | |
random.sample([str(random.randint(lowerband, upperband)) | |
for _ in range(upperband+1)], length) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
return ''.join(random.SystemRandom().choice(chars) for _ in range(20))