4 class TestLoop < Test::Unit::TestCase
7 assert_nothing_raised(LoadError) {require '-test-/random'}
11 rnd = Bug::Random::Loop.new(1)
12 assert_equal("\1", rnd.bytes(1))
16 rnd = Bug::Random::Loop.new(1)
17 assert_equal(1, rnd.rand(10))
21 assert_equal(0.25, Bug::Random::Loop.new(1<<14).rand)
22 assert_equal(0.50, Bug::Random::Loop.new(2<<14).rand)
23 assert_equal(0.75, Bug::Random::Loop.new(3<<14).rand)
24 assert_equal(1.00, Bug::Random::Loop.new(4<<14).rand)