MRG32k3a
umontreal.iro.lecuyer.rng

Class MRG32k3a

  • All Implemented Interfaces:
    Serializable, Cloneable, CloneableRandomStream, RandomStream


    public class MRG32k3aextends RandomStreamBase
    Extends the abstract class RandomStreamBase by using as a backbone (or main) generator the combined multiple recursive generator (CMRG) MRG32k3a proposed by L'Ecuyer, implemented in 64-bit floating-point arithmetic. This backbone generator has a period length of ρ = 2191. The values of V, W, and Z are 251, 276, and 2127, respectively. (See RandomStream for their definition.) The seed of the RNG, and the state of a stream at any given step, are six-dimensional vectors of 32-bit integers, stored in double. The default initial seed of the RNG is (12345, 12345, 12345, 12345, 12345, 12345).
    See Also:
    Serialized Form
    • Constructor Detail

      • MRG32k3a

        public MRG32k3a()
        Constructs a new stream, initializes its seed Ig, sets Bg and Cg equal to Ig, and sets its antithetic switch to false. The seed Ig is equal to the initial seed of the package given by setPackageSeed if this is the first stream created, otherwise it is Z steps ahead of that of the stream most recently created in this class.
      • MRG32k3a

        public MRG32k3a(String name)
        Constructs a new stream with an identifier name (used when printing the stream state).
        Parameters:
        name - name of the stream
    • Method Detail

      • setPackageSeed

        public static void setPackageSeed(long[] seed)
        Sets the initial seed for the class MRG32k3a to the six integers in the vector seed[0..5]. This will be the seed (initial state) of the first stream. If this method is not called, the default initial seed is (12345, 12345, 12345, 12345, 12345, 12345). If it is called, the first 3 values of the seed must all be less than m1 = 4294967087, and not all 0; and the last 3 values must all be less than m2 = 4294944443, and not all 0.
        Parameters:
        seed - array of 6 elements representing the seed
      • setSeed

        public void setSeed(long[] seed)
        Sets the initial seed Ig of this stream to the vector seed[0..5]. This vector must satisfy the same conditions as in setPackageSeed. The stream is then reset to this initial seed. The states and seeds of the other streams are not modified. As a result, after calling this method, the initial seeds of the streams are no longer spaced Z values apart. For this reason, this method should be used only in very exceptional situations (I have never used it myself!); proper use of reset... and of the stream constructor is preferable.
        Parameters:
        seed - array of 6 integers representing the new seed
      • getState

        public long[] getState()
        Returns the current state Cg of this stream. This is a vector of 6 integers. This method is convenient if we want to save the state for subsequent use.
        Returns:
        the current state of the generator
      • toString

        public String toString()
        Returns a string containing the name and the current state Cg 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
      • toStringFull

        public String toStringFull()
        Returns a string containing the name of this stream and the values of all its internal variables.
        Returns:
        the detailed state of the generator, formatted as a string

SCaVis 2.0 © jWork.ORG