# QNGmeterContinuous Real-Time Statistical Tester

**The ComScire® QNGmeter Continuous Real-Time Statistical Tester**

The ComScire QNGmeter is a continuous real-time statistical tester that uses five powerful and fundamentally different tests on the input data. Unlike other statistical test suites, it is designed to measure the quality of randomness of a continuous sequence of bits up to hundreds of terabits in length (real example shown below). The QNGmeter automatically performs metatests of subsequences, which would have to be done manually using other popular test suites.

The five tests are:

- 1/0 Balance – nominal expected value is
*p*(1) =*p*(0) = 0.5. - Auto Correlation – orders 1 through 32, nominal expected value is 0.5 for all orders.
- Entropy Test – nominal expected value is H = 1.0, an update of U. Maurer’s “Universal Test” [Cor99].
- Serial Test – (Good, I. J, The serial test for sampling numbers and other tests for randomness,
*Proc. Camb. Philos. Soc.*Vol. 49, 1953). - OQSO – Overlapping-Quadruples-Sparse-Occupancy test, nominal expected value for the mean = 141909.47 and standard deviation (by simulation) = 294.656 (G. Marsaglia and A. Zaman,
*Computers Math. Applic.*, Vol. 26, No. 9, pp 1-10, 1993).

The z-scores, p-values, and chi-square (metatest) p-values are presented for each test. In addition, current test run time information, such as Bits Tested, Elapsed Time, Throughput, and Bits Tested %, is displayed by the tester. Bits Tested is the total number of bits tested. Elapsed Time is the time from the start of the current test run. Throughput is the input data rate in bits per second. Bits Tested % is the percent of the total bits tested. This value might be less than 100% due to limited CPU resources.

Each test uses blocks of data of varying lengths, depending on the specific test. The 1/0 Balance and Auto Correlation tests use a block size of 65,536 bits. The Serial test has a block size of 262,144 bits. The Entropy test has 4,194,304 bits in a block. The OQSO test uses 10,485,775 bits per block.

A z-score is calculated for every test for each data-block. The z-scores are converted to probabilities with the assumption they are normally distributed. The z-scores of the 1/0 Balance, Auto Correlation and Serial tests and their associated p-values displayed are cumulative for all blocks. The z-scores of the Entropy and OQSO tests are combined by summing the z-scores of all blocks and dividing by the square root of the number of blocks, respectively.

A second level of testing is applied to the p-values calculated from the z-scores for each block of data. The z-scores are expected to be normally distributed and their associated p-values are expected to be uniformly distributed. A chi-square test is applied to the individual p-values from each of the five tests. The chi-square tests are cumulative and their results are displayed as probabilities. If these chi-square p-values converge to 0.0 or 1.0 for any test, the assumption of randomness fails, indicating non-random patterns in the data being tested.

A third level of testing is applied to all of the individual chi-squared tests. A Kolmogorov-Smirnov (KS) test is first applied to the probabilities of chi-squared results of all orders of auto correlation being tested to reduce the auto correlation results to a single probability. A meta-meta KS test is finally calculated using the auto correlation KS result and the probabilities of the chi-squared metatest results of all the other tests. The meta-meta KS+ and KS- probabilities are displayed. Convergence toward 1.0 or 0.0 indicates failure.

The tester is available with the latest QNG software for our hardware generators. A Windows standalone copy is available for download. The source code of the tester (QNGmeter Console) is included in the Linux version of the interface software.