SSJ
V. 2.6.

umontreal.iro.lecuyer.rng
Class MT19937

java.lang.Object
  extended by umontreal.iro.lecuyer.rng.RandomStreamBase
      extended by umontreal.iro.lecuyer.rng.MT19937
All Implemented Interfaces:
Serializable, Cloneable, CloneableRandomStream, RandomStream

public class MT19937
extends RandomStreamBase

Implements the 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.

See Also:
Serialized Form

Constructor Summary
MT19937(CloneableRandomStream rng)
          Constructs a new stream, using rng to fill its initial state.
MT19937(CloneableRandomStream rng, String name)
          Constructs a new stream with the identifier name (used in the toString method).
 
Method Summary
 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.
 String toString()
          Returns a string containing the current state of this stream.
 
Methods inherited from class umontreal.iro.lecuyer.rng.RandomStreamBase
formatState, formatStateFull, increasedPrecision, nextArrayOfDouble, nextArrayOfInt, nextDouble, nextInt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MT19937

public MT19937(CloneableRandomStream rng)
Constructs a new stream, using rng to fill its initial state.

Parameters:
rng - used to build the seed

MT19937

public MT19937(CloneableRandomStream rng,
               String name)
Constructs a new stream with the identifier name (used in the toString method).

Parameters:
rng - used to build the seed
name - name of the stream
Method Detail

clone

public MT19937 clone()
Clones the current generator and return its copy.

Specified by:
clone in interface CloneableRandomStream
Overrides:
clone in class RandomStreamBase
Returns:
A deep copy of the current generator

resetStartStream

public void resetStartStream()
Description copied from interface: RandomStream
Reinitializes the stream to its initial state Ig: Cg and Bg are set to Ig.

Specified by:
resetStartStream in interface RandomStream
Specified by:
resetStartStream in class RandomStreamBase

resetStartSubstream

public void resetStartSubstream()
Description copied from interface: RandomStream
Reinitializes the stream to the beginning of its current substream: Cg is set to Bg.

Specified by:
resetStartSubstream in interface RandomStream
Specified by:
resetStartSubstream in class RandomStreamBase

resetNextSubstream

public void resetNextSubstream()
Description copied from interface: RandomStream
Reinitializes the stream to the beginning of its next substream: Ng is computed, and Cg and Bg are set to Ng.

Specified by:
resetNextSubstream in interface RandomStream
Specified by:
resetNextSubstream in class RandomStreamBase

toString

public String toString()
Description copied from interface: RandomStream
Returns a string containing the current state of this stream.

Specified by:
toString in interface RandomStream
Specified by:
toString in class RandomStreamBase
Returns:
the state of the generator formated as a string

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.