method

seed

Importance_1
Ruby latest stable (v2_5_5) - 0 notes - Class: Random
seed() public

Returns the seed value used to initialize the generator. This may be used to initialize another generator with the same state at a later time, causing it to produce the same sequence of numbers.

prng1 = Random.new(1234)
prng1.seed       #=> 1234
prng1.rand(100)  #=> 47

prng2 = Random.new(prng1.seed)
prng2.rand(100)  #=> 47
Show source
Register or log in to add new notes.