るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.071秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

検索結果

Array#shuffle -> Array (26134.0)

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

...ことができます。

//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!...

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

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

...ことができます。

//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!...