Project

General

Profile

Bug #13753 ยป 0001-Re-initialise-Random-DEFAULT-after-forking-Bug-13753.patch

owst (Owen Stephens), 07/18/2017 04:41 PM

View differences:

random.c
{
rb_random_t *r = &default_rand;
uninit_genrand(&r->mt);
r->seed = INT2FIX(0);
rand_start(r);
}
/*
test/ruby/test_rand.rb
rescue NotImplementedError
end
def test_default_rand_reseed_after_fork
r1 = Random::DEFAULT.rand(42).to_s
r2 = assert_fork_status(1, 'Random::DEFAULT reseed after fork') { Random::DEFAULT.rand(42) }
assert_not_equal(r1, r2, 'Random::DEFAULT correctly reseeded after fork')
end
def test_seed
bug3104 = '[ruby-core:29292]'
rand_1 = Random.new(-1).rand
    (1-1/1)