SSJ
V. 2.6.2.

umontreal.iro.lecuyer.rng
Class F2NL607

java.lang.Object
  extended by umontreal.iro.lecuyer.rng.RandomStreamBase
      extended by umontreal.iro.lecuyer.rng.F2NL607
All Implemented Interfaces:
Serializable, Cloneable, CloneableRandomStream, RandomStream

public class F2NL607
extends RandomStreamBase

Implements the RandomStream interface by using as a backbone generator the combination of the WELL607 proposed in (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.

The combined generator has a period length of approximatively 2637. The values of V, W and Z are 2250, 2150, and 2400, 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.

See Also:
Serialized Form

Constructor Summary
F2NL607()
          Constructs a new stream, initializing it at its beginning.
F2NL607(String name)
          Constructs a new stream with the identifier name (used in the toString method).
 
Method Summary
 F2NL607 clone()
          Clones the current generator and return its copy.
 int[] getLinearState()
          Returns the current state of the linear part of the stream, represented as an array of 19 integers.
static int[][] getNonLinearData()
          Return the data of all the components of the non-linear part of the random number generator.
 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.
 void resetNextSubstream()
          Reinitializes the stream to the beginning of its next substream: Ng is computed, and Cg and Bg are set to Ng.
 void resetStartStream()
          Reinitializes the stream to its initial state Ig: Cg and Bg are set to Ig.
 void resetStartSubstream()
          Reinitializes the stream to the beginning of its current substream: Cg is set to Bg.
 void setLinearSeed(int[] seed)
          This method is discouraged for normal use.
static void setNonLinearData(int[][] data)
          Selects new data for the components of the non-linear generator.
 void setNonLinearSeed(int[] seed)
          This method is discouraged for normal use.
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].
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.
static void setScrambleData(RandomStream rand, int steps, int[] size)
          Selects new data for the components of the non-linear generator.
 String toString()
          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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

F2NL607

public 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

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

Parameters:
name - name of the stream
Method Detail

resetStartStream

public void resetStartStream()
Description copied from interface: RandomStream
Reinitializes the stream to its initial state Ig: Cg and Bg are set to Ig.

Specified by:
resetStartStream in interface RandomStream
Specified by:
resetStartStream in class RandomStreamBase

resetStartSubstream

public void resetStartSubstream()
Description copied from interface: RandomStream
Reinitializes the stream to the beginning of its current substream: Cg is set to Bg.

Specified by:
resetStartSubstream in interface RandomStream
Specified by:
resetStartSubstream in class RandomStreamBase

resetNextSubstream

public void resetNextSubstream()
Description copied from interface: RandomStream
Reinitializes the stream to the beginning of its next substream: Ng is computed, and Cg and Bg are set to Ng.

Specified by:
resetNextSubstream in interface RandomStream
Specified by:
resetNextSubstream in class RandomStreamBase

setPackageLinearSeed

public 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]. 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:
seed - array of 19 elements representing the seed

setLinearSeed

public 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:
seed - array of 19 elements representing the seed

getLinearState

public 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

setPackageNonLinearSeed

public 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. 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:
seed - array of n elements representing the non-linear seed

setNonLinearSeed

public 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 -

getNonLinearState

public 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

getNonLinearData

public static int[][] getNonLinearData()
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

setNonLinearData

public static void setNonLinearData(int[][] data)
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:
data - the new data of the components
Throws:
IllegalStateException - if an instance of the class was constructed before

setScrambleData

public static void setScrambleData(RandomStream rand,
                                   int steps,
                                   int[] size)
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:
rand - the random numbers source to do the scrambling
steps - number of time to do the scrambling
size - size of each components
Throws:
IllegalStateException - if an instance of the class was constructed before

clone

public F2NL607 clone()
Clones the current generator and return its copy.

Specified by:
clone in interface CloneableRandomStream
Returns:
A deep copy of the current generator

toString

public String toString()
Description copied from interface: RandomStream
Returns a string containing the current state 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

SSJ
V. 2.6.2.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.