Skip to content

Instantly share code, notes, and snippets.

@ravage
Created November 25, 2015 17:01
Show Gist options
  • Save ravage/71f3b2f558a22a056192 to your computer and use it in GitHub Desktop.
Save ravage/71f3b2f558a22a056192 to your computer and use it in GitHub Desktop.
Generate Random Alphanumeric String
import random
import string
def random_string(size=8):
rnd = random.SystemRandom()
chars = string.ascii_lowercase + string.digits
return ''.join(rnd.choice(chars) for i in range(size))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment