Changed guide to use random_element.

This commit is contained in:
Rizwan Reza 2010-05-17 02:11:56 +04:30
parent 5de2e0d416
commit 4679b72cba

@ -1894,10 +1894,10 @@ Similarly, +from+ returns the tail from the element at the passed index on:
The methods +second+, +third+, +fourth+, and +fifth+ return the corresponding element (+first+ is builtin). Thanks to social wisdom and positive constructiveness all around, +forty_two+ is also available.
You can pick a random element with +rand+:
You can pick a random element with +random_element+:
<ruby>
shape_type = [Circle, Square, Triangle].rand
shape_type = [Circle, Square, Triangle].random_element
</ruby>
NOTE: Defined in +active_support/core_ext/array/access.rb+.