class method
Random.seed
Random.seed → integer
random.c
View on GitHub ↗
static VALUE
random_s_seed(VALUE obj)
{
rb_random_mt_t *rnd = default_mt();
return rnd->base.seed;
}
Returns the seed value used to initialize the Ruby system PRNG. 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.
Example
Random.seed #=> 1234 prng1 = Random.new(Random.seed) prng1.seed #=> 1234 prng1.rand(100) #=> 47 Random.seed #=> 1234 Random.rand(100) #=> 47