Skip to content

Instantly share code, notes, and snippets.

@ajepe
Last active January 25, 2019 10:12
Show Gist options
  • Save ajepe/61315b4cc599fd09ff4f1d7bc4a7b23d to your computer and use it in GitHub Desktop.
Save ajepe/61315b4cc599fd09ff4f1d7bc4a7b23d to your computer and use it in GitHub Desktop.
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)
)
@ajepe
Copy link
Author

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