From f22c929c8a1e9575ba9f99acdbb061e12d4da4a2 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Tue, 17 Mar 2020 16:40:34 +0100 Subject: Make tst_QRandomGenerator::qualityReal() test more stable Increasing the sample size of randomly generated test samples reduces the probability of small deviations from the expected uniform distribution. On my machine with the new values the test fails approximately once per 3000 consecutive runs, instead of failing once per 300. Change-Id: I4d1815504c353290a2fb350b3fd1cbb802f8d559 Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib/global') diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp index 6f9dcc08f9..5bbde1ef09 100644 --- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp +++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp @@ -671,7 +671,7 @@ void tst_QRandomGenerator::qualityReal() RandomGenerator rng(control); enum { - SampleSize = 160, + SampleSize = 16000, // Expected value: sample size times proportion of the range: PerfectOctile = SampleSize / 8, @@ -679,8 +679,8 @@ void tst_QRandomGenerator::qualityReal() // Variance is (1 - proportion of range) * expected; sqrt() for standard deviations. // Should usually be within twice that and almost never outside four times: - RangeHalf = 25, // floor(4 * sqrt((1 - 0.5) * PerfectHalf)) - RangeOctile = 16 // floor(4 * sqrt((1 - 0.125) * PerfectOctile)) + RangeHalf = 252, // floor(4 * sqrt((1 - 0.5) * PerfectHalf)) + RangeOctile = 167 // floor(4 * sqrt((1 - 0.125) * PerfectOctile)) }; double data[SampleSize]; -- cgit v1.2.3