Skip to content

Instantly share code, notes, and snippets.

@britishtea
Created April 14, 2012 15:54
Show Gist options
  • Save britishtea/2385366 to your computer and use it in GitHub Desktop.
Save britishtea/2385366 to your computer and use it in GitHub Desktop.
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