MersenneTwisterUniformRng .. now correct

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MersenneTwisterUniformRng .. now correct

Michael Dirkmann
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




Reply | Threaded
Open this post in threaded view
|

Re: MersenneTwisterUniformRng .. now correct

Luigi Ballabio-2
Hi Michael,

On 2004.10.29 16:46, [hidden email] wrote:
>
> 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.

Not that I know of---and I, too, think mutable would give the least  
surprising behavior. If nobody objects, I'm going to change it before next  
release.

Later,
        Luigi