Skip to content

Instantly share code, notes, and snippets.

@britishtea
Created April 14, 2012 15:54
String#sample
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