Select a element in the array randomly WITHOUT using the Random
class.
id={1,2,3,4,5}
Is there any method which belongs to the Array
class that is used to randomly select an element?
You can use the sample method
[:foo, :bar].sample # => :foo, or :bar :-)
Credit this SO question/answer