Skip to content

Instantly share code, notes, and snippets.

@zporter
Created June 7, 2011 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zporter/1012985 to your computer and use it in GitHub Desktop.
Save zporter/1012985 to your computer and use it in GitHub Desktop.
Nice little hash / password generator for Ruby 1.9
(('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).sample(30).join #=> "yh8D5NrognVw16GldXPcCxJ24ALU3W"
# with special characters
(('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a + ['!','@','#','$','%','^','&','*']).sample(30).join #=> "Nc&inVolamjMLWfsE#k6$D^p2!b@XC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment