Flowdock
shuffle(*args) public

Returns a new array with elements of this array shuffled.

a = [ 1, 2, 3 ]           #=> [1, 2, 3]
a.shuffle                 #=> [2, 3, 1]

If rng is given, it will be used as the random number generator.

a.shuffle(random: Random.new(1))  #=> [1, 3, 2]
Show source
Register or log in to add new notes.
December 30, 2011
0 thanks

See also: sample

sample randomly picks 1 or n elements from the array