MersenneTwisterUniformRng .. now correct
Posted by Michael Dirkmann on
URL: http://quantlib.414.s1.nabble.com/MersenneTwisterUniformRng-now-correct-tp3385.html
Sorry, mixed up stuff in my first mail. I meant "mutable" in my prefered
behavios (see below for corrected version)
Michael
------------------
Hi,
I am intersted in the rational for chosing the implementation of
MersenneTwisterUniformRng with "Size mti" being static. This choice
leads to different random sequences for the cases sketched below.
My prefered behavior would result when "Size mti" was _mutable_. But there
probably is a good reason for not doing so.
// ----------------
MersenneTwisterUniformRng mt1(42);
MersenneTwisterUniformRng mt2(42);
#ifdef A
for (int i = 0; i < 10; ++i)
cout << mt1.nextInt32() << endl;
for (int i = 0; i < 10; ++i)
cout << mt2.nextInt32() << endl;
#endif
#ifdef B
for (int i = 0; i < 10; ++i)
cout << mt1.nextInt32() << " " << mt2.nextInt32() << endl;
#endif
// ----------------
Regards
Michael