Double the length of random distribution tests to decrease random

failures.
This commit is contained in:
Jesse Schwartzentruber 2017-06-07 10:28:50 -04:00
parent 9f9b83dc96
commit 5be44328f0

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
QUnit.test("MersenneTwister test uniform distribution", function(assert) {
const N = Math.pow(2, 17), TRIES = 10, XSQ = 293.25; // quantile of chi-square dist. k=255, p=.05
const N = Math.pow(2, 18), TRIES = 10, XSQ = 293.25; // quantile of chi-square dist. k=255, p=.05
let mt = new MersenneTwister();
mt.seed(Math.random() * 0x100000000);
for (let attempt = 0; attempt < TRIES; ++attempt) {
@ -18,7 +18,7 @@ QUnit.test("MersenneTwister test uniform distribution", function(assert) {
}
let xsq = bins.reduce(function(a, v){ let e = N / bins.length; return a + Math.pow(v - e, 2) / e; }, 0);
/*
* XSQ = scipy.stats.chi2.isf(.05, 511)
* XSQ = scipy.stats.chi2.isf(.05, 255)
* if xsq > XSQ, the result is biased at 95% significance
*/
if (xsq >= XSQ)
@ -33,7 +33,7 @@ QUnit.test("MersenneTwister test uniform distribution", function(assert) {
});
QUnit.test("MersenneTwister test float distribution", function(assert) {
const N = Math.pow(2, 17), TRIES = 3, XSQ = 564.7; // quantile of chi-square dist. k=511, p=.05
const N = Math.pow(2, 18), TRIES = 3, XSQ = 564.7; // quantile of chi-square dist. k=511, p=.05
let tries = [], mt = new MersenneTwister();
mt.seed(Math.random() * 0x100000000);
for (let attempt = 0; attempt < TRIES; ++attempt) {