Hello Steve, and thank you for your kind help. I am trying to use the boost library as part of a project in which I demonstrate the validity of various random number generation algorithms and methodologies. I wanted to use boost to demonstrate what can be achieved through top class C++ generic programming.
It sounds like Boost.Random may be a good choice for this.
I used mt19937 as you directed and my example did compile but when I ran the binary file through Diehard it failed every single test every time. I am sure this can not be due to the algorithm, but I can not pinpoint what I could be doing in error. Here is the code I used to create a binary file for diehard:
I am not familiar with the "Diehard" tests. But I see a couple of problems in your example code: you are not creating a binary file, and you are not generating random numbers.
ofstream file("MTRNG.bin", ios::binary);
"ios::binary" means open the output text file without \n -> \r\n conversions. It does not make insertions and extractions binary.
file << MT;
This means to save the current state of the random number generator in the text output file. To output the generated random numbers (instead of the random number generator state), use: file << MT(); To output the generated random numbers to a binary file, use: const mt19937::result_type x = MT(); file.write((const char *) &x, sizeof(x));
I was intending on using boost::random to demonstrate various deterministic and non-deterministic RNGs and their validity as far as randomness using Diehard.
A last note: Boost.Random currently only provides one non-deterministic RNG, and it only works on Linux. -Steve