Notes for Intel® oneAPI Math Kernel Library Vector Statistics

ID 772987
Date 12/04/2020
Public
Document Table of Contents

Rank of 31x31 Binary Matrices Test

Test Purpose

The test evaluates the randomness of 31-bit groups of 31 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 31-bit groups of bits (0-30, 1-31, ...) for generators with more than 31 bit precision.

First Level Test

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

Rank Probability in a Truly Random Sequence
31 0.289
30 0.578
29 0.128
<29 0.005

Therefore, the test divides all possible matrix ranks into four groups. The test makes a V statistic with a chi-square distribution with three degrees of freedom for these four 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 - 31 are specific for each BRNG. The test is not applicable for the basic generator WH.

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 - 31. 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-31) 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 31 random bits out of each element of generator integer output such that 31 random numbers of 31 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

The Rank of 31x31 Binary Matrices Test cannot be applied to the generator WH as each element of this generator is only 24-bit.