Skip to content

Instantly share code, notes, and snippets.

@traviskroberts
Created July 21, 2008 20:20
Show Gist options
  • Save traviskroberts/97 to your computer and use it in GitHub Desktop.
Save traviskroberts/97 to your computer and use it in GitHub Desktop.
Generate Random Password
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