diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-30 20:31:31 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-30 20:31:31 +0000 |
commit | d1260a6191bddc5a3c1d1b13dbb7c0fed104be93 (patch) | |
tree | ac347ea9c12887161257d9f2dd1fad0b3b469f26 /test | |
parent | 0d4e8192d87956971771ad6a5aa66deea6eda44e (diff) | |
download | ruby-d1260a6191bddc5a3c1d1b13dbb7c0fed104be93.tar.gz |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_rand.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_rand.rb b/test/ruby/test_rand.rb index d2a1244b0b..db2d4578b8 100644 --- a/test/ruby/test_rand.rb +++ b/test/ruby/test_rand.rb @@ -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 |