Skip to content

Instantly share code, notes, and snippets.

@femoco
Created March 28, 2009 18:15
Show Gist options
  • Save femoco/87163 to your computer and use it in GitHub Desktop.
Save femoco/87163 to your computer and use it in GitHub Desktop.
def get_random_string(length=5)
source=("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a + ["_","-","."]
key=""
length.times{ key += source[rand(source.size)].to_s }
return key
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment