Toolvito

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

Eight tests of NIST SP 800-22 on bits, hexadecimal or the bytes of a file.

Your values

Zeros and ones, or hexadecimal digits; spaces and line breaks are ignored. The example is the binary expansion NIST uses in its examples (n = 100).

More options

Empty: the NIST guidance (M ≥ 20, more than n ÷ 100).

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.

Test many sequences of a large file

Test many sequences of a large file

Choose one file of up to 1 GB: random bytes, or text of 0 and 1, or hexadecimal. The file is cut into sequences of the length you choose (NIST uses 1,000,000 bits and 100 sequences or more), and each test is judged by the share of sequences that pass and how evenly their P-values spread.

Or drop the file here. Any type of file, 1 GB each at most.

    More options

    Tests above run in your browser: the bits and the file you open are not sent anywhere. When you use this box, the file you choose is sent to the Toolvito server. Download the result within one hour after the job finishes. Choose Delete files now to request earlier removal. The hourly cleanup normally removes files within one to two hours after completion.

    How to use it

    1. 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.
    2. Read the P-value of each test: below the level α (0.01) the test found a pattern a random sequence would rarely show.
    3. 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).
    4. 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.

    Related tools