Skip to content

Instantly share code, notes, and snippets.

@lazybios
Created September 5, 2015 05:24
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 lazybios/d774fe1853c8a9333ac0 to your computer and use it in GitHub Desktop.
Save lazybios/d774fe1853c8a9333ac0 to your computer and use it in GitHub Desktop.
#A. Create a Hash
hash = {:key1 => "item1", :key2 => "item2", :key3 => "item3"}
#B. Return a new array of all the Values from the Hash
items = hash.values
#C. Randomly
puts items[rand(items.length)]
@lazybios
Copy link
Author

lazybios commented Sep 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment