mardi 14 juillet 2015

Why would I want to use a custom RNG for Array#shuffle?

The documentation for Array#shuffle states:

shuffle(random: rng) → new_ary

The optional rng argument will be used as the random number generator.

a.shuffle(random: Random.new(1))  #=> [1, 3, 2]

What does that mean and why would I want to do that?




Aucun commentaire:

Enregistrer un commentaire