Rank of 32x32 Binary Matrices Test

Test Purpose

The test evaluates the randomness of 32-bit groups of 32 sequential random numbers of the integer output. The stable response is the rank of the binary matrix composed of the random numbers. The test performs iterations for all possible 32-bit groups of bits (0-31, 1-32,...) for the generators with the bit precision of more than 32 bits.

First Level Test

The first level test selects, with s fixed, groups of bits bs, bs+1, ..., bs+31 from each element of the integer output. Then it forms a binary matrix 32x32 in size from these 32 groups. The first level test composes 40000 of such matrices out of sequential elements of the integer output of the generator.

Then the test computes the number of matrices with the rank of: 32, 31, 30, or less than 30. The following table shows the probability of these ranks in a truly random sequence:

Rank

Probability in a Truly Random Sequence

32

0.289

31

0.578

30

0.128

<30

0.005

Therefore, the test divides all possible matrix ranks into four groups. The test makes a V statistics with a chi-square distribution with three degrees of freedom for these three groups. Then the first level test applies the chi-square goodness-of-fit test to the groups. The testing result is the p-value.

In the table below, NB stands for the number of bits required to represent a random number in integer arithmetic, WS stands for the machine word size, in bits, used in integer random number generation.

Note

The acceptable values of 0 £ s £ NB - 32 are specific for each BRNG. The test cannot be applied to the WH generator as each element of this generator is only 24-bit. The test cannot be applied to the MCG31 generator as each element of this generator is only 31-bit.

BRNG

Integer Output Interpretation

MCG31m1

Array of 32-bit integers. Each 32-bit integer uses the following bits:

 0-30. NB=31, WS=32.

R250

Array of 32-bit integers. Each 32-bit integer uses the following bits:

 0-31. NB=32, WS=32.

MRG32k3a

Array of 32-bit integers. Each 32-bit integer uses the following bits:

 0-31. NB=32, WS=32. 

MCG59

Array of 64-bit integers. Each 64-bit integer uses the following bits:

 0-58. NB=59, WS=64. 

WH

Array of quadruples of 32-bit integers. Each 32-bit integer uses the following bits:

0-23. NB=24, WS=32.

MT19937

Array of 32-bit integers. Each 32-bit integer uses the following bits:

0-31. NB=32, WS=32. 

MT2203

Array of 32-bit integers. Each 32-bit integer uses the following bits:

0-31. NB=32, WS=32. 

SFMT19937

Array of quadruples of 32-bit integers. Each 32-bit integer uses the following bits:

0-31. NB=32, WS=32. 

PHILOX4X32X10

Array of 32-bit integers. Each 32-bit integer uses the following bits:

0-31. NB=32, WS=32. 

ARS5

Array of 32-bit integers. Each 32-bit integer uses the following bits:

0-31. NB=32, WS=32. 

The test selects only NB of lower bits from each WS-bit integer to form a bit sequence.

Second Level Test

The second level test performs the first level test ten times for the fixed s. The result is the set of p-values pj, j = 1, 2, ..., 10.The test applies the Kolmogorov-Smirnov goodness-of-fit test with Anderson-Darling statistics to the obtained set of pj, j = 1, 2, ..., 10. If the resulting p-value is p < 0.05 or p > 0.95, the test fails for the s.

Final Result Interpretation

The second level test performs ten times for each 0 £ s £ NB - 32. The test computes the FAIL percentage of the failed second level tests. The final result is the minimal percentage of the failed tests FAIL = min(FAIL0, FAIL1, ..., FAILNB-32) for 0 £ s £ NB - 32. The acceptable result is the value of FAIL < 50%. Therefore the test indicates whether it is possible to single out at least 32 random bits out of each element of generator integer output such that 32 random numbers of 32 bits each have a random enough behavior under this particular test.

Tested Generators

Function Name

Application

vsRngUniform

not applicable

vdRngUniform

not applicable

viRngUniform

not applicable

viRngUniformBits

applicable

Function Name

Application

vsRngUniform

not applicable

vdRngUniform

not applicable

viRngUniform

not applicable

viRngUniformBits

applicable

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