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.
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.
Leave a Reply