Extends the abstract class RandomStreamBase by using as a backbone (or main) generator the combined multiple recursive generator (CMRG) MRG32k3a proposed by L’Ecuyer [145] , implemented in 64-bit floating-point arithmetic. More...
Public Member Functions | |
| MRG32k3a () | |
| Constructs a new stream, initializes its seed \(I_g\), sets. | |
| MRG32k3a (String name) | |
| Constructs a new stream with an identifier name (used when printing the stream state). | |
| void | setSeed (long seed[]) |
| Sets the initial seed \(I_g\) of this stream to the vector seed[0..5]. | |
| 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: | |
| void | resetNextSubstream () |
| Reinitializes the stream to the beginning of its next substream: | |
| long[] | getState () |
| Returns the current state \(C_g\) of this stream. | |
| String | toString () |
| Returns a string containing the name and the current state \(C_g\) of this stream. | |
| String | toStringFull () |
| Returns a string containing the name of this stream and the values of all its internal variables. | |
| MRG32k3a | clone () |
| Clones the current generator and return its copy. | |
| Public Member Functions inherited from umontreal.ssj.rng.RandomStreamBase | |
| 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). | |
| double | nextDouble () |
| Returns a uniform random number between 0 and 1 from the stream. | |
| void | nextArrayOfDouble (double[] u, int start, int n) |
| Calls nextDouble n times to fill the array u. | |
| int | nextInt (int i, int j) |
| Calls nextDouble once to create one integer between i and j. | |
| void | nextArrayOfInt (int i, int j, int[] u, int start, int n) |
| Calls nextInt n times to fill the array u. | |
| String | formatState () |
| Use the toString method. | |
| String | formatStateFull () |
| Use the toStringFull method. | |
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]. | |
Protected Member Functions | |
| double | nextValue () |
| This method should return the next random number (between 0 and 1) from the current stream. | |
Extends the abstract class RandomStreamBase by using as a backbone (or main) generator the combined multiple recursive generator (CMRG) MRG32k3a proposed by L’Ecuyer [145] , 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)\).
Definition at line 46 of file MRG32k3a.java.
| umontreal.ssj.rng.MRG32k3a.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.
Definition at line 120 of file MRG32k3a.java.
| umontreal.ssj.rng.MRG32k3a.MRG32k3a | ( | String | name | ) |
Constructs a new stream with an identifier name (used when printing the stream state).
| name | name of the stream |
Definition at line 136 of file MRG32k3a.java.
| MRG32k3a umontreal.ssj.rng.MRG32k3a.clone | ( | ) |
Clones the current generator and return its copy.
Reimplemented from umontreal.ssj.rng.RandomStreamBase.
Definition at line 272 of file MRG32k3a.java.
| long[] umontreal.ssj.rng.MRG32k3a.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.
Definition at line 205 of file MRG32k3a.java.
|
protected |
This method should return the next random number (between 0 and 1) from the current stream.
If the stream is set to the high precision mode (increasedPrecision(true) was called), then each call to nextDouble will call nextValue twice, otherwise it will call it only once.
Reimplemented from umontreal.ssj.rng.RandomStreamBase.
Definition at line 285 of file MRG32k3a.java.
| void umontreal.ssj.rng.MRG32k3a.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\).
Reimplemented from umontreal.ssj.rng.RandomStreamBase.
Definition at line 193 of file MRG32k3a.java.
| void umontreal.ssj.rng.MRG32k3a.resetStartStream | ( | ) |
Reinitializes the stream to its initial state \(I_g\): \(C_g\) and \(B_g\) are set to \(I_g\).
Reimplemented from umontreal.ssj.rng.RandomStreamBase.
Definition at line 178 of file MRG32k3a.java.
| void umontreal.ssj.rng.MRG32k3a.resetStartSubstream | ( | ) |
Reinitializes the stream to the beginning of its current substream:
\(C_g\) is set to \(B_g\).
Reimplemented from umontreal.ssj.rng.RandomStreamBase.
Definition at line 184 of file MRG32k3a.java.
|
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.
| seed | array of 6 elements representing the seed |
Definition at line 151 of file MRG32k3a.java.
| void umontreal.ssj.rng.MRG32k3a.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.
| seed | array of 6 integers representing the new seed |
Definition at line 170 of file MRG32k3a.java.
| String umontreal.ssj.rng.MRG32k3a.toString | ( | ) |
Returns a string containing the name and the current state \(C_g\) of this stream.
Reimplemented from umontreal.ssj.rng.RandomStreamBase.
Definition at line 215 of file MRG32k3a.java.
| String umontreal.ssj.rng.MRG32k3a.toStringFull | ( | ) |
Returns a string containing the name of this stream and the values of all its internal variables.
Definition at line 238 of file MRG32k3a.java.