SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Package Functions | Static Package Attributes | List of all members
F2NL607 Class Reference

Implements the RandomStream interface by using as a backbone generator the combination of the WELL607 proposed in [199], [198]  (and implemented in WELL607 ) with a nonlinear generator. More...

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

Public Member Functions

 F2NL607 ()
 Constructs a new stream, initializing it at its beginning. More...
 
 F2NL607 (String name)
 Constructs a new stream with the identifier name (used in the toString method). 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\).
 
void setLinearSeed (int seed[])
 This method is discouraged for normal use. More...
 
int [] getLinearState ()
 Returns the current state of the linear part of the stream, represented as an array of 19 integers. More...
 
void setNonLinearSeed (int seed[])
 This method is discouraged for normal use. More...
 
int [] getNonLinearState ()
 Returns the current state of the non-linear part of the stream, represented as an array of \(n\) integers, where \(n\) is the number of components in the non-linear generator. More...
 
F2NL607 clone ()
 Clones the current generator and return its copy. More...
 
String toString ()
 Returns a string containing the current state of this stream. More...
 
- Public Member Functions inherited from WELL607base
WELL607base clone ()
 Clones the current object and returns 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 setPackageLinearSeed (int seed[])
 Sets the initial seed of the linear part of the class F2NL607 to the 19 integers of the vector seed[0..18]. More...
 
static void setPackageNonLinearSeed (int seed[])
 Sets the non-linear part of the initial seed of the class F2NL607 to the \(n\) integers of the vector seed[0..n-1], where \(n\) is the number of components of the non-linear part. More...
 
static int [][] getNonLinearData ()
 Return the data of all the components of the non-linear part of the random number generator. More...
 
static void setNonLinearData (int[][] data)
 Selects new data for the components of the non-linear generator. More...
 
static void setScrambleData (RandomStream rand, int steps, int[] size)
 Selects new data for the components of the non-linear generator. More...
 

Protected Member Functions

double nextValue ()
 
- Protected Member Functions inherited from WELL607base
void advanceSeed (int[] seed, int [] p)
 
- 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...
 

Static Package Functions

 [static initializer]
 
- Static Package Functions inherited from WELL607base
static void verifySeed (int seed[])
 

Static Package Attributes

static int [] nlJumpZ
 
- Static Package Attributes inherited from WELL607base
static final double NORM = (1.0 / 0x100000001L)
 
static final int R = 19
 
static final int BUFFER_SIZE = 32
 
static final int NUM_BITS = 608
 
static final int MASK_STATE = 0x0000001F
 
static final int W = 32
 
static final int P = 1
 
static final int MASKU = (0xffffffff >>> (W - P))
 
static final int MASKL = (~MASKU)
 
static final int M1 = 16
 
static final int M2 = 15
 
static final int M3 = 14
 
static final int R1 = 18
 
static final int R2 = 17
 
static final int w = 250
 
static final int v = 150
 

Additional Inherited Members

- 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
 
- Package Functions inherited from WELL607base
int [] getState ()
 
String stringState ()
 
int nextInt ()
 
- Package Attributes inherited from WELL607base
int state_i
 
int [] state
 
int [] stream
 
int [] substream
 

Detailed Description

Implements the RandomStream interface by using as a backbone generator the combination of the WELL607 proposed in [199], [198]  (and implemented in WELL607 ) with a nonlinear generator.

This nonlinear generator is made up of a small number of components (say \(n\)) combined via addition modulo 1. Each component contains an array already filled with a "random" permutation of \(\{0,...,s-1\}\) where s is the size of the array. These numbers and the lengths of the components can be changed by the user. Each call to the generator uses the next number in each array (or the first one if we are at the end of the array). By default, there are 3 components of lengths 1019, 1021, and 1031, respectively. The non-linear generator is combined with the WELL using a bitwise XOR operation. This ensures that the new generator has at least as much equidistribution as the WELL607, as shown in [123] .

The combined generator has a period length of \(\rho\approx\) \(2^{637}\). The values of \(V\), \(W\) and \(Z\) are \(2^{250}\), \(2^{150}\), and \(2^{400}\), respectively (see RandomStream for their definition). The seed of the RNG has two part: the linear part is a 19-dimensional vector of 32-bit integers, while the nonlinear part is made up of a \(n\)-dimensional vector of indices, representing the position of the generator in each array of the nonlinear components.

Constructor & Destructor Documentation

◆ F2NL607() [1/2]

F2NL607 ( )

Constructs a new stream, initializing it at its beginning.

Also makes sure that the seed of the next constructed stream is \(Z\) steps away. Sets its antithetic switch to false and sets the stream to normal precision mode (offers 32 bits of precision).

◆ F2NL607() [2/2]

F2NL607 ( String  name)

Constructs a new stream with the identifier name (used in the toString method).

Parameters
namename of the stream

Member Function Documentation

◆ clone()

F2NL607 clone ( )

Clones the current generator and return its copy.

Returns
A deep copy of the current generator

Implements CloneableRandomStream.

◆ getLinearState()

int [] getLinearState ( )

Returns the current state of the linear part of the stream, represented as an array of 19 integers.

Returns
the current state of the stream

◆ getNonLinearData()

static int [][] getNonLinearData ( )
static

Return the data of all the components of the non-linear part of the random number generator.

This data is explained in the introduction.

Returns
the data of the components

◆ getNonLinearState()

int [] getNonLinearState ( )

Returns the current state of the non-linear part of the stream, represented as an array of \(n\) integers, where \(n\) is the number of components in the non-linear generator.

Returns
the current state of the stream

◆ setLinearSeed()

void setLinearSeed ( int  seed[])

This method is discouraged for normal use.

Initializes the stream at the beginning of a stream with the initial linear seed seed[0..18]. The seed must satisfy the same conditions as in setPackageSeed. The non-linear seed is not modified; thus the non-linear part of the random number generator is reset to the beginning of the old stream. This method only affects the specified stream; the others are not modified. Hence after calling this method, the beginning of the streams will no longer be spaced \(Z\) values apart. For this reason, this method should only be used in very exceptional cases; proper use of the reset... methods and of the stream constructor is preferable.

Parameters
seedarray of 19 elements representing the seed

◆ setNonLinearData()

static void setNonLinearData ( int  data[][])
static

Selects new data for the components of the non-linear generator.

The number of arrays in data will decide the number of components. Each of the arrays will be assigned to one of the components. The period of the resulting non-linear generator will be equal to the lowest common multiple of the lengths of the arrays. It is thus recommended to choose only prime length for the best results.

NOTE : This method cannot be called if at least one instance of F2NL607 has been constructed. In that case, it will throw an IllegalStateException.

Parameters
datathe new data of the components
Exceptions
IllegalStateExceptionif an instance of the class was constructed before

◆ setNonLinearSeed()

void setNonLinearSeed ( int  seed[])

This method is discouraged for normal use.

Initializes the stream at the beginning of a stream with the initial non-linear seed seed[0..n-1], where \(n\) is the number of components of the non-linear part of the generator. The linear seed is not modified so the linear part of the random number generator is reset to the beginning of the old stream. This method only affects the specified stream; the others are not modified. Hence after calling this method, the beginning of the streams will no longer be spaced \(Z\) values apart. For this reason, this method should only be used in very exceptional cases; proper use of the reset... methods and of the stream constructor is preferable.

Parameters
seed

◆ setPackageLinearSeed()

static void setPackageLinearSeed ( int  seed[])
static

Sets the initial seed of the linear part of the class F2NL607 to the 19 integers of the vector seed[0..18].

This will be the initial seed (or seed) of the next created stream. At least one of the integers must be non-zero and if this integer is the last one, it must not be equal to 0x7FFFFFFF.

Parameters
seedarray of 19 elements representing the seed

◆ setPackageNonLinearSeed()

static void setPackageNonLinearSeed ( int  seed[])
static

Sets the non-linear part of the initial seed of the class F2NL607 to the \(n\) integers of the vector seed[0..n-1], where \(n\) is the number of components of the non-linear part.

The default is \(n = 3\). Each of the integers must be between 0 and the length of the corresponding component minus one. By default, the lengths are \((1019, 1021, 1031)\).

Parameters
seedarray of \(n\) elements representing the non-linear seed

◆ setScrambleData()

static void setScrambleData ( RandomStream  rand,
int  steps,
int []  size 
)
static

Selects new data for the components of the non-linear generator.

The number of arrays in data will decide the number of components. Each of the arrays will be assigned to one of the components. The period of the resulting non-linear generator will be equal to the lowest common multiple of the lengths of the arrays. It is thus recommended to choose only prime length for the best results.

NOTE : This method cannot be called if at least one instance of F2NL607 has been constructed. In that case, it will throw an IllegalStateException.

Parameters
randthe random numbers source to do the scrambling
stepsnumber of time to do the scrambling
sizesize of each components
Exceptions
IllegalStateExceptionif an instance of the class was constructed before

◆ toString()

String toString ( )

Returns a string containing the current state of this stream.

Returns
the state of the generator formated as a string

Implements RandomStream.


The documentation for this class was generated from the following file: