Print

Print


On Feb 6, 2006, at 2:49 PM, Michael Makowsky wrote:

> new MersenneTwisterFast(seed)

This will seed the Mersenne Twister with the provided seed.  If you  
seed with the same number, you will always get the same sequence.

> new MersenneTwisterFast();
This seeds with a seed based on the current time in milliseconds.   
Thus each time you do this you are likely to get a different sequence.

> random.setSeed(System.currentTimeMillis() + id);

I'm not positive why you're setting the seed to the current time  
(plus a constant) when you just seeded the RNG to the current time,  
but at any rate, you'll get different values each time again.



A reminder: if you always seed a random number generator with a given  
seed, you will get an identical sequence of numbers each time.  If  
you seed the random number generator with a different seed (typically  
by seeding it with the current time, which is the default constructor  
new MersenneTwister() ), you will get a different sequence of numbers  
each time except in the exceptionally unusual circumstance where you  
had two computers with identical millisecond time.

Sean