Skip to content

Instantly share code, notes, and snippets.

@jcaxmacher
Created May 6, 2014 15:07
Show Gist options
  • Save jcaxmacher/6e06d98a64ab91acef8f to your computer and use it in GitHub Desktop.
Save jcaxmacher/6e06d98a64ab91acef8f to your computer and use it in GitHub Desktop.
import random
def random_password():
alpha_lower = random.sample('abcdefghijklmnopqrstuvwxyz', 5)
alpha_upper = random.sample('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 10)
num = random.sample('0123456789', 4)
special = random.sample('!@#$%^&*', 4)
full = alpha_upper + alpha_lower + num + special
random.shuffle(full)
return ''.join(full)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment