What is the most important test for a uniform random number generator ? Is there a single most important test or a set? I am a using some analytically arrived at answers to probability problems and checking the simulation answers obtained through a random generator. For all the probability problems that I analysed and simulated and checked, they are coming pretty close to the analytical results.
1 Answers
Any single test is inadequate. A single test will find failures of randomness of one kind, but the generated numbers might still be very orderly in other respects. So it's best to use a bunch of different tests that look for different patterns.
I'm not sure I understand your use case (and by now you may no longer have the same need), but if you really want to test the quality of a uniform random number generator, you should use a high-quality, up to date test suite such as Pierre L'Ecuyer's TestU01. A random number generator that passes all of the tests might still exhibit systematic nonrandom patterns (and if it's a pseudorandom number generating algorithm, it's guaranteed to do so), but the chance that they'd make a difference to your application would be small.
The papers linked at the TestU01 page are very informative, too, as is Melissa O'Neil's PCG paper. Good books include:
- Kneusel's Random Numbers and Computers
- Johnston's Random Number Generators--Principles and Practices.
- Knuth, Chapter 3 in volume 2 of the 3rd edition of The Art of Computer Programming (still deserves to be called the "bible" of pseudorandom number generation, even though there have been crucial innovations since it was published, so there are better algorithms now.)
(Some partially-similar questions I've answered on another site:
- https://stats.stackexchange.com/questions/335203/understanding-different-kinds-of-rngs-tests/407910#407910
- https://stats.stackexchange.com/questions/438398/is-there-a-way-to-visualize-the-limited-randomness-of-an-algorithm/439691#439691
- https://stats.stackexchange.com/questions/436733/is-there-such-a-thing-as-a-good-bad-seed-in-pseudo-random-number-generation/438057#438057 )
- 1,338