Calculates on this device. File exports run online.
Randomness Test
Check whether a sequence looks random. Paste bits or hexadecimal, or open a file, and the tool runs eight statistical tests of NIST SP 800-22, the test suite for random number generators, each with its P-value. For dice rolls, draws or the numbers of a generator, it runs a chi-square test of an even spread, a runs test and a serial correlation test. A test can find a pattern, but passing never proves that a sequence is random.
Enter your values
Check these values
This is off unless you turn it on. Saved entries stay in this browser only. Untick the box to delete them.
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to use it
- Choose A sequence of bits (NIST tests), then type 0 and 1, type hexadecimal, or open a file whose bytes are read as bits. Press Run the tests.
- Read the P-value of each test: below the level α (0.01) the test found a pattern a random sequence would rarely show.
- For numbers, choose A list of numbers, paste them in the order they came, and say which values can come up (for a die, 1 to 6).
- To judge a generator the way NIST does, test many sequences of a large file in the box below.
The tests
- Frequency: as many ones as zeros. Frequency within a block: the same in blocks of M bits. Runs: changes from 0 to 1 neither too few nor too many. Longest run of ones: the longest run in each block as random data has it.
- Cumulative sums: the running total of +1 and −1 does not wander too far, forward or backward. Approximate entropy and serial: every pattern of m bits about as often as any other. Discrete Fourier transform: no repeating cycle.
- Not run here: the matrix rank, template matching, Maurer's universal, linear complexity and random excursions tests of the same suite.
- NIST recommends at least 100 bits for most tests, 1,000 for the Fourier test and more for large m; the table says when a sequence is shorter.
What a result means
A P-value is the chance that random data would look at least this unusual in the way the test measures. With α = 0.01, about one random sequence in a hundred fails a test by chance, so one failure alone says little. A sequence can pass every test and still come from a predictable generator: these tests cannot show that data is unpredictable, which cryptography needs.