seed

prng.seed â integer
Instance Public methods

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
doc_ruby_on_rails
2015-05-01 00:35:43
Comments
Leave a Comment

Please login to continue.