The test verifies that the sample distribution function agrees with the hypothesized distribution. A chi-squared
statistic with the number of degrees of freedom that is minus one from the number of the intervals of partition is considered a stable response.
First Level Test
For a given parameter set and a given sample size, the test computes the partition of the distribution domain into disjoint intervals, so that the a priori quantity of random numbers from each interval is of order 100.
The test computes the actual number of random values within each interval of the generated sample and then calculates chi-square of the statistic
. The statistic
is asymptotically of chi-squared distribution
- 1 degrees of freedom, where
is the number of the intervals. Thus, the p-value equal to
should be of a distribution that is close to uniform.
Second Level Test
The first level test is run ten times, each run producing a p-value
= 1, 2, ... , 10. The Kolmogorov-Smirnov goodness-of-fit test with Anderson-Darling’s statistics is applied to the obtained p-values
= 1, 2, ... , 10. If the resulting p-value
Interpreting Final Results
The final result of the test is the percentage FAIL of failed second level tests. The second level test is run ten times. The value of FAIL < 50% is considered acceptable.