Array#rand
September 17th, 2007
Quickie: pick a random out of an array, or returns nil if the array is empty.
['my', 'little', 'pony'].rand # => 'pony'
['my', 'little', 'pony'].rand # => 'my'
[ ].rand # => nil
Quickie: pick a random out of an array, or returns nil if the array is empty.
['my', 'little', 'pony'].rand # => 'pony'
['my', 'little', 'pony'].rand # => 'my'
[ ].rand # => nil
Sorry, comments are closed for this article.