Skip to content

Instantly share code, notes, and snippets.


ajepe/random number

Last active Jan 25, 2019
What would you like to do?
my crazy random number and otp
''.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)

This comment has been minimized.

Copy link
Owner Author

@ajepe ajepe commented Jan 25, 2019

chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
return ''.join(random.SystemRandom().choice(chars) for _ in range(20))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.