summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-01 07:59:03 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-01 07:59:03 +0000
commit237fc688394b84ec286572995d393b709d4987d6 (patch)
tree5c15be668195fc04c9b69a24830127b79f5cb80e /test
parent58a4828163a15e496410b0803866f1b80c7545a4 (diff)
merges r26936 from trunk into ruby_1_9_1 and little refactoring.
-- * random.c (rb_reset_random_seed): set seed in this. [ruby-core:28655] -- * random.c: refactoring. * random.c (rand_srand): a new function that wraps rand_init and (re)initialization of the random seed as a VALUE. * random.c (genrand_int32, genrand_real, rb_f_rand, rb_f_srand): using rand_srand. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@28511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_rand.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_rand.rb b/test/ruby/test_rand.rb
index b7d841dbba..4887377c6d 100644
--- a/test/ruby/test_rand.rb
+++ b/test/ruby/test_rand.rb
@@ -164,4 +164,14 @@ class TestRand < Test::Unit::TestCase
srand(0)
assert_equal([1,4,2,5,3], [1,2,3,4,5].shuffle)
end
+
+ def test_fork_shuffle
+ pid = fork do
+ (1..10).to_a.shuffle
+ raise 'default seed is not set' if srand == 0
+ end
+ p2, st = Process.waitpid2(pid)
+ assert(st.success?)
+ rescue NotImplementedError, ArgumentError
+ end
end