r/C_Programming • u/greg-spears • Oct 21 '26
Semi-Advanced Randomness Test Library?
Looking for a semi-advanced randomness test library. Not something too advanced, though. Like a library of a hundred files that I'd maybe need a week just to get a clean compile. Also not with tests having results so intricate and complex that it would take significant hours just to understand the results.
Ideally, a library that provides results in percentages of excellence per test, which could be weighted and summed to provide an overall score. Maybe 10 important tests, and with high-precision, and so that means Ai solutions aren't quite up for the task?
This I confess, I found out directly when I allowed Deepseek and Google Ai to create test suites each, and stdlib rand() repeatedly outperforms raw bytes downloaded from random.org -- and that can't be right? Maybe I should ask Claud?
Or not. Maybe had enough of Ai hallucinations, so I'm hoping for some human guidance.
2
u/sciencekm Oct 21 '26
Lookup "PractRand"
1
u/greg-spears Oct 23 '26
Found this, looks good. But there are some questions about its authenticity.
1
u/CreideikiVAX Oct 24 '26
I see you've already been pointed towards PractRand, so I won't duplicate that recommendation.
The other well regarded test suite is TestU01 by L'Ecuyer and Simard. It has a few caveats to its use versus PractRand that should be noted; for example, it operates on 32-bit integers only, so if you have a PRNG that emits 64-bit values you need to test it a few different ways (splitting up the 64-bit value into halves and emitting them in sequence, testing only the low 32-bits, testing only the high 32-bits, bit reversed versions of the previous tests).