Welcome to the testers of JavaScript and JSSim random generators

The testers available test for uniform distribution of generated singles, pairs and triples. The interval [0,1] in each dimension is first divided into a certain number n of equal subintervals that generates n, n2, and n3 bins. The program then finds the actual frequencies of all bins and compares them with the theoretical frequency. Results contain the maximum and the minimum frequencies, the chi-square test value and the table of frequencies with simple semi-graphics bar chart, that should be as flat as possible.

How to use the testers

There are several versions of the tester. Follow the guidelines shown by the Help buttons. Note that the theoretical frequency should be at least 100 (minimum value is 5) and preferably use such numbers, that the total number of samples is a multiple of the number of bins (though it is not necessary). Then select the output (table, window or both). Results placed into a new browser window can se saved and then processed - copied to documents, etc. Details how to do it depend on the browser. Usually Save As... or just Copy - Paste will do what you need. Use the testers with possibility of changing the generator constants if you want to change the default JSSim (MINSTD = Minimum Standard) random generator.

Chi-Square Test

The so-called chi-square test is one of the most popular goodness-of-fit tests used to determine if a certain population has a specific theoretical distribution. In our case the theoretical distribution is the uniform distribution on the interval [0,1], the unit square or the unit cube respectively . The chi-square value is a value of a random variable whose sampling distribution is approximated very closely by the chi-square distribution with n - 1 degrees of freedom, where n is the number of bins. This value is computed as a sum of squares of differences between the actual and the theoretical frequencies for each bin, divided by the theoretical frequency. Small values indicate a good fit. There are tables with chi-square values for various degrees of freedom and various significance levels (usually 5% and 1%) - see the following table for the level 5%, where degrees of freedom correspond to selected numbers of intervals. Note that the last three values are the numbers of bins (minus 1) in the unit cube for 10, 15 and 20 intervals in each dimension.

Degrees of freedom Chi-square value
4 9.488
9 16.919
14 23.685
19 30.144
24 36.415
29 42.557
39 54.572
49 66.339
99 123.225
224 259.914
399 446.574
999 1073.643
3374 3510.246
7999 8208.177

For other values of the number of degrees of freedom there are chi-square calculators, for example: http://www.fourmilab.ch/rpkp/experiments/analysis/chiCalc.html

Compare the computed value with the tabular value. If the computed value is bigger, the generator is with probability 95% not a uniform one. The opposite is generally not true. The chi-square test is known for its poor capabilities to reject wrong hypotheses.  So a small chi-square value means that the generator might be acceptable.