Skip to content

Instantly share code, notes, and snippets.

@p-hennessy
Created December 29, 2014 03:58
Show Gist options
  • Save p-hennessy/df40a70127571a724806 to your computer and use it in GitHub Desktop.
Save p-hennessy/df40a70127571a724806 to your computer and use it in GitHub Desktop.
Python Random String Generator
#!/usr/bin/python
import random
def genId(length=10, charset="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"):
output = ""
for i in range(length):
output += random.choice(charset)
return output
random.seed()
print genId()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment