Guides › Comparing test suites
SP 800-22 vs Dieharder vs TestU01 vs SP 800-90B
These tools answer different questions. Picking the wrong one either wastes days or gives you a result nobody will accept.
At a glance
| Tool | Question it answers | Data needed | Typical use |
|---|---|---|---|
| NIST SP 800-22 | Does this bit sequence show any of 15 known non-random patterns? | ~106 bits per sequence; many sequences to judge a generator | Quick screening of RNG/TRNG output, coursework, design checks |
| Dieharder | Does the generator fail a broad battery of classic tests? | Large: from hundreds of megabytes to gigabytes, or a live generator | Wider screening of software and hardware generators |
| TestU01 | Does a PRNG survive very demanding batteries (SmallCrush, Crush, BigCrush)? | Billions of numbers; BigCrush runs for hours | Research-grade evaluation of pseudorandom generators |
| PractRand | At what output length does a flaw become detectable? | Streams from megabytes up to terabytes | Stress-testing PRNGs until they break |
| NIST SP 800-90B | How much min-entropy does this noise source deliver per sample? | 1,000,000 samples, plus 1,000 restarts × 1,000 samples | Entropy source validation for FIPS 140-3 |
NIST SP 800-22
Fifteen tests, each returning a p-value, designed for random and pseudorandom bit generators used in cryptography. Its strength is that it works on modest amounts of data and produces results that are easy to explain. Its limits: it is a screening tool. Passing does not show unpredictability, and the suite does not estimate entropy. Start with how to run it.
Dieharder
Robert G. Brown's open-source suite collects George Marsaglia's original Diehard tests along with additional tests, and reports each as PASSED, WEAK or FAILED. It can test built-in generators directly or read a stream from a file or stdin. When a file is too small, Dieharder re-reads it from the start ("rewinds"), which invalidates many tests. Use large files or pipe from the generator.
TestU01
Pierre L'Ecuyer and Richard Simard's C library is the standard for evaluating pseudorandom number generators. SmallCrush runs in seconds; Crush and BigCrush take hours and consume billions of outputs, typically by linking your generator in as a function. For hardware generators that produce bit files, TestU01 also includes the Rabbit and Alphabit batteries.
PractRand
PractRand reads a stream and keeps testing at doubling lengths, reporting the point where anomalies appear. It is very effective at exposing weak PRNGs, which often fail somewhere between gigabytes and terabytes of output.
NIST SP 800-90B
SP 800-90B is about entropy sources, not finished random output. It checks whether samples look independent and identically distributed, then applies a set of estimators to give a conservative min-entropy per sample, and adds restart tests. For FIPS 140-3, entropy sources are validated against SP 800-90B, not SP 800-22. NIST publishes a reference implementation on GitHub.
Which one should I use?
- Coursework or a first check of a TRNG/PRNG design: SP 800-22.
- Choosing or publishing a PRNG algorithm: TestU01 BigCrush and PractRand.
- Broad screening of a hardware generator with plenty of output: SP 800-22 plus Dieharder.
- FIPS 140-3 entropy source validation: SP 800-90B, usually with an accredited lab.
Start with the quick screen. Run all 15 SP 800-22 tests on your file, free, and see every p-value.
Run the free testNISTTEST.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. Product names belong to their respective authors.