Skip to content

Instantly share code, notes, and snippets.

@kkosuge
Created November 1, 2011 04:32
Show Gist options
  • Save kkosuge/1329942 to your computer and use it in GitHub Desktop.
Save kkosuge/1329942 to your computer and use it in GitHub Desktop.
def randstr(i=15)
Array.new(i){(('a'..'z').to_a+('A'..'Z').to_a+('0'..'9').to_a)[rand(62)]}.join
end
p randstr #=> "ibhUMSWD0cSKomi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment