Reputation: 18069
Lately I implemented a MersenneTwister for 64-bit integer
(or long
). Is there a guide or examples of how to test PRNG so that I may know whether or not my implementation is good-enough solution. I'm specially interested into how to verify if my implementation has good enough uniform distribution.
The more specifically this is tied to MersenneTwister the better.
Upvotes: 5
Views: 3632
Reputation: 326
Aloha!
As someone else said - use the known answer test vectors for the algorithms. If you meet the test vectors you can be reasonably sure that your generator works.
If you really want to test the generator. Use the DIEHARD tests++ as implemented by the Dieharder tool:
http://www.phy.duke.edu/~rgb/General/dieharder.php
Upvotes: 1
Reputation: 30089
You do not need to test the Mersenne Twister algorithm -- that's been done over and over by people who really know what they're doing -- you only have to test whether you've correctly implemented the algorithm.
You can go to the Mersenne Twister web site and grab their test output. If you produce the same sequence of outputs that they do, you've probably implemented the algorithm correctly.
Note that the MT site has a link specifically for 64 bit machines and different test outputs for 32 and 64 bit versions.
Upvotes: 14
Reputation: 82535
The standard battery of tests for a PRNG is the Diehard Tests.
Upvotes: 8
Reputation: 13121
Easiest approach (If it's truely generic MT) would be to compared it with a known-good MT library with the same seed.
Upvotes: 2