Skip to content

Instantly share code, notes, and snippets.

@scottjacksonx
Created March 14, 2010 01:59
Show Gist options
  • Save scottjacksonx/331707 to your computer and use it in GitHub Desktop.
Save scottjacksonx/331707 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#I have this as a [TextExpander][1] snippet for naming things "randomly."
#So I type "rstr" (without quotes, duh) anywhere in OS X and I get a random 24-character string.
#
#[1]: http://www.smileonmymac.com/TextExpander/index.html
import random
import sys
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
randStr = ""
random.seed()
for i in range(0,24):
rand = random.randint(0,25)
randStr += alphabet[rand]
sys.stdout.write(randStr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment