Guides › Interpreting p-values

Interpreting SP 800-22 p-values: pass, fail and N/A

Every SP 800-22 test turns your bit sequence into a p-value. Reading those numbers correctly is the difference between a real finding and a false alarm.

Updated October 20, 2026

What a p-value means here

Each test assumes the sequence is random, computes a statistic, and asks how likely a statistic at least that extreme would be for random data. That probability is the p-value.

Why one failure is expected

Because α = 0.01, a perfect random generator still fails any single test about 1% of the time. Across 15 tests the chance that a random sequence fails at least one is 1 − 0.9915 ≈ 14%. The NIST reference code reports several p-values for some tests (for example one per template or per random-walk state), so it produces even more chance failures.

One failed test on one sequence is weak evidence. Re-run on a fresh capture. A real weakness fails the same test again; a chance failure moves around.

Judging a generator: proportion and uniformity

SP 800-22 section 4.2 evaluates a generator by testing many sequences (m of them) and checking two things for each test.

1. Proportion of passing sequences

The expected pass rate is p̂ = 1 − α = 0.99. The acceptable range is

p̂ ± 3 · sqrt( p̂ (1 − p̂) / m )

For m = 100 sequences that is 0.99 ± 0.0298, so the pass rate should be at least about 0.96: roughly 96 or more of the 100 sequences pass each test.

2. Uniformity of the p-values

The p-values of a test across all sequences are sorted into 10 equal bins between 0 and 1, and a χ² test (9 degrees of freedom) checks whether they are evenly spread. The p-values are considered uniform when this second-level value, P-valueT, is at least 0.0001. NIST recommends at least 55 sequences for this check.

When a test keeps failing

Failing testUsual cause
Frequency, Block Frequency, CusumBias: more ones than zeros overall or in parts of the stream (unbalanced comparator, missing debiasing)
Runs, Longest RunBits that are correlated with their neighbours, e.g. sampling a slow noise source too fast
DFT (Spectral)Periodic structure, such as interference from a clock or a repeating buffer
Linear Complexity, Matrix RankLinear structure, typical of LFSR-based or poorly mixed generators
Maurer's Universal, Approximate Entropy, SerialRepeating patterns or low entropy; the data is compressible
Everything failsUsually an input mistake: text read as binary, a header in the file, or repeated data (check your file)

N/A is not a failure

An N/A result means the sequence was shorter than the test needs. The Overlapping Template, Random Excursions and Random Excursions Variant tests, for instance, expect about 1,000,000 bits, and the Random Excursions tests also need at least 500 cycles of the random walk. Capture more data rather than treating N/A as a fail (minimum length per test).

See your own p-values. NISTTEST.COM shows every test's p-value and pass/fail on screen for free.

Run the free test

NISTTEST.COM is an independent implementation of NIST SP 800-22 Rev. 1a and is not affiliated with or endorsed by the National Institute of Standards and Technology.