Return to Snippet

Revision: 16039
at July 24, 2009 04:32 by gatement


Initial Code
def generate_password(length=6)
   chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ23456789'
   password = ''  
   length.downto(1) { |i| password << chars[rand(chars.length - 1)] }
   password
end

Initial URL

                                

Initial Description
Generate random password.
e.g. reset user's password.

Initial Title
Generate random password

Initial Tags

                                

Initial Language
Ruby