Created
April 14, 2012 15:54
-
-
Save britishtea/2385366 to your computer and use it in GitHub Desktop.
String#sample
This file contains 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 String | |
def sample | |
slice rand(length) | |
end | |
end | |
puts "hahaha".sample # => "h" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment