Class F2NL607
 java.lang.Object
 umontreal.iro.lecuyer.rng.RandomStreamBase
 umontreal.iro.lecuyer.rng.F2NL607
 All Implemented Interfaces:
 Serializable, Cloneable, CloneableRandomStream, RandomStream
public class F2NL607extends RandomStreamBase
Implements theRandomStream
interface by using as a backbone generator the combination of the WELL607 proposed in (and implemented inWELL607
) 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 nonlinear 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 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 19dimensional vector of 32bit integers, while the nonlinear part is made up of a ndimensional vector of indices, representing the position of the generator in each array of the nonlinear components. See Also:
 Serialized Form
Constructor Summary
Constructors Constructor and Description 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
Methods Modifier and Type Method and Description 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 nonlinear part of the random number generator.int[]
getNonLinearState()
Returns the current state of the nonlinear part of the stream, represented as an array of n integers, where n is the number of components in the nonlinear generator.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
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
setLinearSeed(int[] seed)
This method is discouraged for normal use.static void
setNonLinearData(int[][] data)
Selects new data for the components of the nonlinear 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 nonlinear part of the initial seed of the class F2NL607 to the n integers of the vector seed[0..n1], where n is the number of components of the nonlinear part.static void
setScrambleData(RandomStream rand, int steps, int[] size)
Selects new data for the components of the nonlinear 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
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 I_{g}: C_{g} and B_{g} are set to I_{g}. Specified by:
resetStartStream
in interfaceRandomStream
 Specified by:
resetStartStream
in classRandomStreamBase
resetStartSubstream
public void resetStartSubstream()
Description copied from interface:RandomStream
Reinitializes the stream to the beginning of its current substream: C_{g} is set to B_{g}. Specified by:
resetStartSubstream
in interfaceRandomStream
 Specified by:
resetStartSubstream
in classRandomStreamBase
resetNextSubstream
public void resetNextSubstream()
Description copied from interface:RandomStream
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}. Specified by:
resetNextSubstream
in interfaceRandomStream
 Specified by:
resetNextSubstream
in classRandomStreamBase
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 nonzero 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 nonlinear seed is not modified; thus the nonlinear 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 nonlinear part of the initial seed of the class F2NL607 to the n integers of the vector seed[0..n1], where n is the number of components of the nonlinear 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 nonlinear 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 nonlinear seed seed[0..n1], where n is the number of components of the nonlinear 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 nonlinear part of the stream, represented as an array of n integers, where n is the number of components in the nonlinear generator. Returns:
 the current state of the stream
getNonLinearData
public static int[][] getNonLinearData()
Return the data of all the components of the nonlinear 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 nonlinear 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 nonlinear 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 nonlinear 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 nonlinear 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 scramblingsteps
 number of time to do the scramblingsize
 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 interfaceCloneableRandomStream
 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 interfaceRandomStream
 Specified by:
toString
in classRandomStreamBase
 Returns:
 the state of the generator formated as a string
SCaVis 2.2 © jWork.ORG