るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.045秒)
トップページ > クエリ:new[x] > クエリ:rand[x] > クエリ:shuffle[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

クラス

検索結果

Array#shuffle(random: Random) -> Array (18332.0)

配列の要素をランダムシャッフルして,その結果を配列として返します。

...します。

引数に Random オブジェクトを渡すことでそのオブジェクトが
生成する擬似乱数列を用いることができます。

//emlist[例][ruby]{
a = [ 1, 2, 3 ] #=> [1, 2, 3]
a.shuffle #=> [2, 3, 1]
rng = Random.new
rng2 = rng.dup # RNG...
...を複製
# 以下の2つは同じ結果を返す
[1,2,3].shuffle(random: rng)
[1,2,3].shuffle(random: rng2)
//}

@see Array#shuffle!...