* random.c (Init_RandomSeed): move all Random::DEFAULT

construction bits to Init_RandomSeed2. Random::DEFAULT
  and Ruby internal hashes are no longer shared their seed.
* random.c (Init_RandomSeed2): ditto. And, kill evil
  rb_obj_reveal() stuff.
* random.c (init_hashseed): add MT argument.
* random.c: (init_siphash): ditto.
* test/ruby/test_rand.rb (TestRand#test_default_seed): new
  test for Random::DEFAULT::seed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2015-11-30 20:31:31 +00:00
parent 052535be3e
commit 99c05fb38e
3 changed files with 56 additions and 29 deletions

View file

@ -524,4 +524,13 @@ END
[1, 2].sample(1, random: gen)
assert_equal(2, gen.limit, bug7935)
end
def test_default_seed
assert_separately([], <<-End)
seed = Random::DEFAULT::seed
rand1 = Random::DEFAULT::rand
rand2 = Random.new(seed).rand
assert_equal(rand1, rand2)
End
end
end