November 2013 - Ravi Desai

Ruby: Select random element from array

This is a cool little trick I picked up from StackOverflow. Select random element of an array [:foo, :bar].sample Its the Array#sample instance method. Good to know.