|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.tudelft.simulation.jstats.streams.RandomNumberGenerator
nl.tudelft.simulation.jstats.streams.MersenneTwister
public class MersenneTwister
A java implementation of the Mersenne Twister pseudo random number generator.
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.
Field Summary |
---|
Fields inherited from class nl.tudelft.simulation.jstats.streams.RandomNumberGenerator |
---|
seed |
Constructor Summary | |
---|---|
MersenneTwister()
constructs a new Mersenne Twister. |
|
MersenneTwister(long seed)
Constructor using a given seed. |
Method Summary | |
---|---|
protected long |
next(int bits)
returns the next value in the stream. |
void |
setSeed(long seed)
sets the seed of the generator |
Methods inherited from class nl.tudelft.simulation.jstats.streams.RandomNumberGenerator |
---|
getSeed, nextBoolean, nextDouble, nextFloat, nextInt, nextInt, nextLong, reset, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MersenneTwister()
System.currentTimeMillis()
is used as seed value.
public MersenneTwister(long seed)
seed
- The initial seed.Method Detail |
---|
protected long next(int bits)
RandomNumberGenerator
next
in class RandomNumberGenerator
bits
- the number of bits used
RandomNumberGenerator.next(int)
public void setSeed(long seed)
StreamInterface
setSeed
in interface StreamInterface
setSeed
in class RandomNumberGenerator
seed
- the new seedStreamInterface.setSeed(long)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |