# Rank of 6x8 Binary Matrices Test

## Test Purpose

The test evaluates the randomness of the 8-bit groups of 6 sequential random numbers of the integer output. The stable response is the rank of the binary matrix composed of the random numbers. The test checks all possible 8-bit groups: 0-7, 1-8, ...

## First Level Test

The first level test selects, with s fixed, groups of bits bs, bs+1, ..., bs+7 from each element of the integer output and forms a binary matrix 6x8 in size from these 6 groups. The first level test composes 100000 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: 6, 5, or less than 5. The following table shows the probability of these ranks in a truly random sequence:

Rank

Probability in a Truly Random Sequence

6

0.773

5

0.217

<5

0.010

Therefore, the test divides all possible matrix ranks into three groups. The test makes a V statistic with a chi-square distribution with two 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 - 8 are specific for each BRNG. The test checks each of the four elements of the integer output for the WH and SFMT19937 basic generators.

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 a 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 - 8. 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-8) for 0 £ s £ NB - 31. The acceptable result is the value of FAIL < 50%. Therefore the test indicates whether it is possible to single out at least 8 random bits out of each element of generator integer output such that six random numbers of eight 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

The Rank of 6x8 Binary Matrices Test checks each element of the WH generator separately as different multiplicative generators produce its elements.

For more complete information about compiler optimizations, see our Optimization Notice.