method

shuffle

v1_9_1_378 - Show latest stable - Class: Array
shuffle()
public

Returns a new array with elements of this array shuffled.

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

1Note

See also: sample

leente ยท Dec 30, 2011

sample randomly picks 1 or n elements from the array