Created
July 28, 2011 03:03
-
-
Save tyabe/1110887 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
class Integer | |
def rand_s(char_set=('0'..'z')) | |
c=char_set.to_a | |
self.times.inject([]){|a|a<<c[rand(c.size)]}.join | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment