I am using a C# implementation of Mersenne Twister I downloaded from CenterSpace. I have two problems with it:
- No matter how I seed the algorithm it does not pass DieHard tests, and by that I mean I get quite a lot of 1s and 0s for p-value. Also my KStest on 269 p-values is 0. Well, I cannot quite interpret p-value, but I think a few 1s and 0s in the result is bad news.
- I have been asked to visually show the randomness of the numbers. So I plot the numbers as they are generated, and this does not seem random at all. Here is two screenshots of the result after a few seconds and a few seconds later. As you can see in the second screenshot the numbers fall on some parallel lines. I have tried different algorithms to map numbers to points. They all result in parallel lines, but with different angles! This is how I mapped numbers to points for these screenshots:
new Point(number % _canvasWidth, number % _canvasHeight)
. As you may guess, the visual result depends on the form's width and height, and this is a disasterous result.
Here is a few ways I tried to seed the algorithm:
- User entry. I enter some numbers to seed the algorithm as an int array.
- Random numbers generated by the algorithm itself!!
- An array of
new Guid().GetHashCode()
What am I missing here? How should I seed the algorithm? How can I get it pass the DieHard?