I'm having trouble determining which variant of Mersenne Twister C++11 provides. Looking at Matsumoto and Nishimura ACM paper at Mersenne twister: A 623 Dimensionally Equidistributed Uniform Pseudorandom Number Generator, the authors provide the algorithm, an implementation of the algorithm, and call it MT19937
.
However, when I test C++11's same-named generator with the small program below, I cannot reproduce the stream created by Matsumoto and Nishimura's MT19937. The streams differ from the very first 32-bit word produced.
Which Mersenne Twister does C++11 provide?
The program below was run on Fedora 22 using GCC, -std=c++11
and GNU's stdlibc++
.
std::mt19937 prng(102013);
for (unsigned int i = 0; i <= 625; i++)
{
cout << std::hex << prng();
if(i+1 != 625)
cout << ",";
if(i && i%8 == 0)
cout << endl;
}
libstdc++
.std::tr1::mt19937
, which then becamestd::mt19937
in C++11, so the Boost comments are likely very relevant. You should follow the second link in my earlier comment and compare against the output presented in there.