Craps Test

Test Purpose

The test evaluates the randomness of the output sequence of random numbers of the uniform distribution that imitates the process of dice tossing when gambling Craps. The stable response is the number of tosses of the pair of dice necessary to complete the game and the frequency of wins in the game.

First Level Test

The test forms a sequence of random numbers equiprobably taking the values from 1 to 6 from the output sequence of random numbers. The test treats every number as a number of spots on the face of a die. Thus the test regards a pair of numbers as the result of a toss of two dice. If on the first throw of dice the sum of the spots on the faces of dice equals to 7 or 11, it is a win; if the sum equals 2, 3 or 12, it is a loss. In other cases it is necessary to make additional throws to define the result of the game.

The test performs additional throws until the sum of the spots equals to 7 or coincides with the sum thrown on the first throw. If the sum equals to 7, it is a loss, otherwise, it is a win.

The theoretical probability of the win is 244/495, that is, a little less than 0.5. Further, the frequency of wins with the K-multiple repeats of the game, when K = 200,000, has a very close to normal distribution with mean a = K*244/495 and standard deviation s = a*251/495.

The number of throws necessary to complete the game can take the 1,2, ... values. On K-multiple iterations of the game, the test computes the frequencies of getting c = 1, c = 2, ..., c = 20, c > 20. Based on these frequencies, the test makes the chi-square statistics V with the chi-square distribution with 20 degrees of freedom.

The result of the first level test is the pair of p-values p and q for the number of tosses and the frequency of wins respectively.

Second Level Test

The test performs the first level test ten times. The result of each iteration of the first level test is the pair of p-values pj and qj, j = 1, 2, ..., 10. The test applies the Kolmogorov-Smirnov goodness-of-fit test with Anderson-Darling statistics to the obtained p-values of pj, j = 1, 2, ..., 10. If the resulting p-value is p < 0.05 or p > 0.95, the test fails. Similarly, the test applies the Kolmogorov-Smirnov goodness-of-fit test with Anderson-Darling statistics to the obtained p-values of qj, j = 1, 2, ..., 10. If the resulting p-value is q < 0.05 or q > 0.95, the s test fails. The test passes in all other cases.

Final Result Interpretation

The final result of the test is the percentage FAIL of the failed second level tests. The test performs the second level test ten times. The acceptable result is the value of FAIL < 50%.

Tested Generators

Function Name

Application

vsRngUniform

applicable

vdRngUniform

applicable

viRngUniform

applicable

viRngUniformBits

applicable

Function Name

Application

vsRngUniform

applicable

vdRngUniform

applicable

viRngUniform

applicable

viRngUniformBits

applicable

For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)