зеркало из https://github.com/github/ruby.git
test_rand.rb: refine probability test
* test/ruby/test_rand.rb (test_new_seed): refine probability of failure from 1/256 to 1/256**8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
a3d25f54bd
Коммит
2edcca66e3
|
@ -559,8 +559,14 @@ END
|
|||
end
|
||||
|
||||
def test_new_seed
|
||||
v = Random.new_seed
|
||||
assert_kind_of(Integer, v)
|
||||
assert_operator(v.size, :>=, 16)
|
||||
size = 0
|
||||
n = 8
|
||||
n.times do
|
||||
v = Random.new_seed
|
||||
assert_kind_of(Integer, v)
|
||||
size += v.size
|
||||
end
|
||||
# probability of failure <= 1/256**8
|
||||
assert_operator(size.fdiv(n), :>, 15)
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче