The NIST Special Publication 800-22 is "A statistical test suite for random and pseduorandom number generators for cryptographic applications." Whew!
This provides a complete implementation of all the tests in Mathematica
Version 0.9.2 -- 07-Oct-06.
All code is licensed under the the standard BSD License
Every example in the specification is recreated in order to verify the algorithms. A change log is included in the notebook.
Unfortunately the specification contains a few errors. Here's what I found:
Everything works, with some tests producing slight deviations from spec mostly due to numerical precision. The Spectral test is the lone oddball -- it "works" but the intermediate results do not match at all was is published. Use with caution and see notes below:
1. Monobit Frequency Test -- OK 2. Block Frequency Test - OK 3. Runs Test -- OK, tau parameter not implemented 4. Longest Runs Test -- Ok, slight difference due to precision 5. Matrix -- Ok, possible numerical precision error in text. 6. Spectral -- Seems to work, but I can't get match the intermediate results. 7. Non-overlapping template -- OK -- G-SHA-1 test is not complete, but otherwise looks OK 8. Overlapping --OK, text has bad example 9. Mauers --OK, but need to implement main example 10. Lempel-Ziv -- OK, but I get an of-by-one count in main example 11. Linear Complexity -- ok 13. Approximate Entropy -- Ok 14. Cummulative Sums -- Ok, slight numerical deviatation in simple example. Main example is same as specifiaction. 15. Random Excusions -- Ok, pik table is exact, while specification uses 4 digits of precision causing slight discrepancy. 16. Random Excursions Variant-- OK, exact
not quite done yet...