The argument must be a random number generator (RNG).
If not specified, it defaults to implementing the Ruby stock.
It can be replaced with an arbitrary RNG, as well as random:
class NotAtAllRandom def self.rand(x=0) 0 end end > (1..10000).sample(3, random: NotAtAllRandom) => [1, 2, 3] > (1..10000).sample(3, random: NotAtAllRandom) => [1, 2, 3]
Dave newton
source share