public class MersenneTwister extends RandomNumberGenerator
This is a Java version of the C-program for MT19937: Integer version. genrand() generates one pseudorandom unsigned integer (32bit) which is uniformly distributed among 0 to 2^32-1 for each call. sgenrand(seed) set initial values to the working area of 624 words. (seed is any 32-bit integer except for 0).
Orignally Coded by Takuji Nishimura, considering the suggestions by Topher Cooper and Marc Rieffel in July-Aug. 1997. More information can be found at http://www.math.keio.ac.jp/matumoto/emt.html .
Makoto Matsumoto and Takuji Nishimura, the original authors ask "When you use this, send an email to: matumoto@math.keio.ac.jp with an appropriate reference to your work" You might also point out this was a translation.
(c) copyright 2004 Delft
University of Technology , the Netherlands.
See for project information
www.simulation.tudelft.nl
License of use: Lesser
General Public License (LGPL) , no warranty.
seed
Constructor and Description |
---|
MersenneTwister()
constructs a new Mersenne Twister.
|
MersenneTwister(long seed)
Constructor using a given seed.
|
Modifier and Type | Method and Description |
---|---|
protected long |
next(int bits)
returns the next value in the stream.
|
void |
setSeed(long seed)
sets the seed of the generator
|
getSeed, nextBoolean, nextDouble, nextFloat, nextInt, nextInt, nextLong, reset, toString
public MersenneTwister()
System.currentTimeMillis()
is used as seed value.public MersenneTwister(long seed)
seed
- The initial seed.protected long next(int bits)
RandomNumberGenerator
next
in class RandomNumberGenerator
bits
- the number of bits usedRandomNumberGenerator.next(int)
public void setSeed(long seed)
StreamInterface
setSeed
in interface StreamInterface
setSeed
in class RandomNumberGenerator
seed
- the new seedStreamInterface.setSeed(long)
Copyright © 2002-2012 Delft University of Technology, the Netherlands. All Rights Reserved.