public class MT19937 extends RandomStreamBase
RandomStream interface via inheritance from
RandomStreamBase. The backbone generator is the MT19937
Mersenne Twister, proposed by Matsumoto and Nishimura, which has a state size of 19937 bits and a period length of
approximatively 219937.
Each instance uses another CloneableRandomStream to fill its initial state.
With this design, the initial states of successive streams are not
spaced by an equal number of steps, and there is no guarantee that
different streams do not overlap, but damaging overlap is unlikely
because of the huge size of the state space.
The seed of the RNG, and the state of a stream at any given
step, is a 624-dimensional vector of 32-bit integers.
The output of nextValue has 32 bits of precision.| Constructor and Description |
|---|
MT19937(CloneableRandomStream rng)
Constructs a new stream, using rng to fill its initial state.
|
MT19937(CloneableRandomStream rng,
java.lang.String name)
Constructs a new stream with the identifier name
(used in the toString method).
|
| Modifier and Type | Method and Description |
|---|---|
MT19937 |
clone()
Clones the current generator and return its copy.
|
void |
resetNextSubstream()
Reinitializes the stream to the beginning of its next
substream: Ng is computed, and
Cg and Bg are set to Ng.
|
void |
resetStartStream()
Reinitializes the stream to its initial state Ig:
Cg and Bg are set to Ig.
|
void |
resetStartSubstream()
Reinitializes the stream to the beginning of its current
substream: Cg is set to Bg.
|
java.lang.String |
toString()
Returns a string containing the current state of this stream.
|
formatState, formatStateFull, increasedPrecision, nextArrayOfDouble, nextArrayOfInt, nextDouble, nextIntpublic MT19937(CloneableRandomStream rng)
rng - used to build the seedpublic MT19937(CloneableRandomStream rng, java.lang.String name)
rng - used to build the seedname - name of the streampublic MT19937 clone()
clone in interface CloneableRandomStreamclone in class RandomStreamBasepublic void resetStartStream()
RandomStreamresetStartStream in interface RandomStreamresetStartStream in class RandomStreamBasepublic void resetStartSubstream()
RandomStreamresetStartSubstream in interface RandomStreamresetStartSubstream in class RandomStreamBasepublic void resetNextSubstream()
RandomStreamresetNextSubstream in interface RandomStreamresetNextSubstream in class RandomStreamBasepublic java.lang.String toString()
RandomStreamtoString in interface RandomStreamtoString in class RandomStreamBaseTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.