Skip to content

Instantly share code, notes, and snippets.

@tyabe
Created July 28, 2011 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyabe/1110887 to your computer and use it in GitHub Desktop.
Save tyabe/1110887 to your computer and use it in GitHub Desktop.
ランダムな文字列を返す
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