SSJ  3.3.1 Stochastic Simulation in Java
MRG32k3a Class Reference

Extends the abstract class RandomStreamBase by using as a backbone (or main) generator the combined multiple recursive generator (CMRG) MRG32k3a proposed by L’Ecuyer [148] , implemented in 64-bit floating-point arithmetic. More...

Inheritance diagram for MRG32k3a:
[legend]
Collaboration diagram for MRG32k3a:
[legend]

## Public Member Functions

MRG32k3a ()
Constructs a new stream, initializes its seed $$I_g$$, sets $$B_g$$ and $$C_g$$ equal to $$I_g$$, and sets its antithetic switch to false. More...

MRG32k3a (String name)
Constructs a new stream with an identifier name (used when printing the stream state). More...

void setSeed (long seed[])
Sets the initial seed $$I_g$$ of this stream to the vector seed[0..5]. More...

void resetStartStream ()
Reinitializes the stream to its initial state $$I_g$$: $$C_g$$ and $$B_g$$ are set to $$I_g$$.

void resetStartSubstream ()
Reinitializes the stream to the beginning of its current substream: $$C_g$$ is set to $$B_g$$.

void resetNextSubstream ()
Reinitializes the stream to the beginning of its next substream: $$N_g$$ is computed, and $$C_g$$ and $$B_g$$ are set to $$N_g$$.

long [] getState ()
Returns the current state $$C_g$$ of this stream. More...

String toString ()
Returns a string containing the name and the current state $$C_g$$ of this stream. More...

String toStringFull ()
Returns a string containing the name of this stream and the values of all its internal variables. More...

MRG32k3a clone ()
Clones the current generator and return its copy. More...

Public Member Functions inherited from RandomStreamBase
abstract void resetStartStream ()
Reinitializes the stream to its initial state $$I_g$$: $$C_g$$ and $$B_g$$ are set to $$I_g$$.

abstract void resetStartSubstream ()
Reinitializes the stream to the beginning of its current substream: $$C_g$$ is set to $$B_g$$.

abstract void resetNextSubstream ()
Reinitializes the stream to the beginning of its next substream: $$N_g$$ is computed, and $$C_g$$ and $$B_g$$ are set to $$N_g$$.

abstract String toString ()
Returns a string containing the current state of this stream. More...

void increasedPrecision (boolean incp)
After calling this method with incp = true, each call to the RNG (direct or indirect) for this stream will return a uniform random number with more bits of precision than what is returned by nextValue, and will advance the state of the stream by 2 steps instead of 1 (i.e., nextValue will be called twice for each random number). More...

double nextDouble ()
Returns a uniform random number between 0 and 1 from the stream. More...

void nextArrayOfDouble (double[] u, int start, int n)
Calls nextDouble n times to fill the array u. More...

int nextInt (int i, int j)
Calls nextDouble once to create one integer between i and j. More...

void nextArrayOfInt (int i, int j, int[] u, int start, int n)
Calls nextInt n times to fill the array u. More...

String formatState ()
Use the toString method.

String formatStateFull ()
Use the toStringFull method.

RandomStreamBase clone ()
Clones the current generator and return its copy. More...

## Static Public Member Functions

static void setPackageSeed (long seed[])
Sets the initial seed for the class MRG32k3a to the six integers in the vector seed[0..5]. More...

## Protected Member Functions

double nextValue ()

Protected Member Functions inherited from RandomStreamBase
abstract double nextValue ()
This method should return the next random number (between 0 and 1) from the current stream. More...

## Package Attributes

double Cg1

double Cg2

double Cg3

double Cg4

double Cg5

Protected Attributes inherited from RandomStreamBase
String name = null

boolean prec53 = false

boolean anti = false

Static Protected Attributes inherited from RandomStreamBase
static double invtwo24 = 5.9604644775390625e-8

## Detailed Description

Extends the abstract class RandomStreamBase by using as a backbone (or main) generator the combined multiple recursive generator (CMRG) MRG32k3a proposed by L’Ecuyer [148] , implemented in 64-bit floating-point arithmetic.

This backbone generator has a period length of $$\rho\approx2^{191}$$. The values of $$V$$, $$W$$, and $$Z$$ are $$2^{51}$$, $$2^{76}$$, and $$2^{127}$$, 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)$$.

## ◆ MRG32k3a() [1/2]

 MRG32k3a ( )

Constructs a new stream, initializes its seed $$I_g$$, sets $$B_g$$ and $$C_g$$ equal to $$I_g$$, and sets its antithetic switch to false.

The seed $$I_g$$ is equal to the initial seed of the package given by setPackageSeed(long[]) 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() [2/2]

 MRG32k3a ( String name )

Constructs a new stream with an identifier name (used when printing the stream state).

Parameters
 name name of the stream

## ◆ clone()

 MRG32k3a clone ( )

Clones the current generator and return its copy.

Returns
A deep copy of the current generator

Implements CloneableRandomStream.

## ◆ getState()

 long [] getState ( )

Returns the current state $$C_g$$ 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

## ◆ setPackageSeed()

 static void setPackageSeed ( long seed[] )
static

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 $$m_1 = 4294967087$$, and not all 0; and the last 3 values must all be less than $$m_2 = 4294944443$$, and not all 0.

Parameters
 seed array of 6 elements representing the seed

## ◆ setSeed()

 void setSeed ( long seed[] )

Sets the initial seed $$I_g$$ 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

## ◆ toString()

 String toString ( )

Returns a string containing the name and the current state $$C_g$$ of this stream.

Returns
the state of the generator, formated as a string

Implements RandomStream.

## ◆ toStringFull()

 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

The documentation for this class was generated from the following file:
• MRG32k3a.java