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>
This commit is contained in:
parent
028ddf3633
commit
f22c929c8a
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user