Created
September 5, 2015 05:24
-
-
Save lazybios/d774fe1853c8a9333ac0 to your computer and use it in GitHub Desktop.
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
#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)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://snipplr.com/view/3895/