Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Arrayクラス > shuffle!

instance method Array#shuffle!

shuffle! -> self

配列を破壊的にランダムシャッフルします。

例:

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

[SEE_ALSO] Array#shuffle

class Array