Skip to content

Instantly share code, notes, and snippets.

@mikeadmire
Created September 25, 2013 13:15
Show Gist options
  • Save mikeadmire/6699417 to your computer and use it in GitHub Desktop.
Save mikeadmire/6699417 to your computer and use it in GitHub Desktop.
Generate a random password hash
def random_password(size = 10)
chars = (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a) - %w(i o 0 1 l 0 I O)
(1..size).collect{ |a| chars[rand(chars.size)] }.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment