Method: Random::ArrayExtensions#shuffle
- Defined in:
- lib/standard/facets/random.rb
#shuffle ⇒ Object
Randomize the order of an array.
[1,2,3,4].shuffle #~> [2,4,1,3]
209 210 211 212 |
# File 'lib/standard/facets/random.rb', line 209 def shuffle dup.shuffle! #sort_by{Random.number} end |