Created
July 21, 2008 20:20
-
-
Save traviskroberts/97 to your computer and use it in GitHub Desktop.
Generate Random Password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_password(length=6) | |
chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ23456789' | |
password = '' | |
length.times { password << chars[rand(chars.length)] } | |
password | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment