summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-03-17 16:40:34 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2020-03-25 22:19:24 +0100
commitf22c929c8a1e9575ba9f99acdbb061e12d4da4a2 (patch)
treea99412a458fce8422a199b95c428d1b62dc8c741 /tests
parent028ddf3633f394c930ddb82551ef2d1fa9b1a04a (diff)
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 <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp6
1 files changed, 3 insertions, 3 deletions
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];