Created
April 24, 2010 06:59
-
-
Save qichunren/377511 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
chars = ("a".."z").to_a + ("0".."9").to_a | |
#puts chars | |
Array.new(6, '').collect{chars[rand(chars.size)]}.join | |
end | |
#测试 | |
puts generate_password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment