umontreal.iro.lecuyer.rng
Class MT19937
- java.lang.Object
-
- umontreal.iro.lecuyer.rng.RandomStreamBase
-
- umontreal.iro.lecuyer.rng.MT19937
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, CloneableRandomStream, RandomStream
public class MT19937 extends RandomStreamBase
Implements theRandomStreaminterface via inheritance fromRandomStreamBase. 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 anotherCloneableRandomStreamto 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
Constructors 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).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description MT19937clone()Clones the current generator and return its copy.voidresetNextSubstream()Reinitializes the stream to the beginning of its next substream: Ng is computed, and Cg and Bg are set to Ng.voidresetStartStream()Reinitializes the stream to its initial state Ig: Cg and Bg are set to Ig.voidresetStartSubstream()Reinitializes the stream to the beginning of its current substream: Cg is set to Bg.java.lang.StringtoString()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
-
-
-
-
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, java.lang.String name)
Constructs a new stream with the identifier name (used in the toString method).- Parameters:
rng- used to build the seedname- name of the stream
-
-
Method Detail
-
clone
public MT19937 clone()
Clones the current generator and return its copy.- Specified by:
clonein interfaceCloneableRandomStream- Overrides:
clonein classRandomStreamBase- Returns:
- A deep copy of the current generator
-
resetStartStream
public void resetStartStream()
Description copied from interface:RandomStreamReinitializes the stream to its initial state Ig: Cg and Bg are set to Ig.- Specified by:
resetStartStreamin interfaceRandomStream- Specified by:
resetStartStreamin classRandomStreamBase
-
resetStartSubstream
public void resetStartSubstream()
Description copied from interface:RandomStreamReinitializes the stream to the beginning of its current substream: Cg is set to Bg.- Specified by:
resetStartSubstreamin interfaceRandomStream- Specified by:
resetStartSubstreamin classRandomStreamBase
-
resetNextSubstream
public void resetNextSubstream()
Description copied from interface:RandomStreamReinitializes the stream to the beginning of its next substream: Ng is computed, and Cg and Bg are set to Ng.- Specified by:
resetNextSubstreamin interfaceRandomStream- Specified by:
resetNextSubstreamin classRandomStreamBase
-
toString
public java.lang.String toString()
Description copied from interface:RandomStreamReturns a string containing the current state of this stream.- Specified by:
toStringin interfaceRandomStream- Specified by:
toStringin classRandomStreamBase- Returns:
- the state of the generator formated as a string
-
-
DMelt 3.0 © DataMelt by jWork.ORG