The documentation for Array#shuffle states:
shuffle(random: rng) → new_aryThe optional
rngargument will be used as the random number generator.a.shuffle(random: Random.new(1)) #=> [1, 3, 2]
If I don’t supply the optional random argument, what is used for it?
Equivalently, if I call a.shuffle(random: rng), what does rng need to be to make it the same as just a.shuffle?
>Solution :
It’s right in the signature, shuffle(random: Random). That says the default value for random is the Random Class object.
The class method
Random.randprovides the base functionality ofKernel.randalong with better handling of floating point values. These are both interfaces to the Ruby system PRNG.