For each type of base RNG (i.e., each implementation of the RandomStream interface), the full period of the generator is cut into adjacent streams (or segments) of length Z, and each of these streams is partitioned into V substreams of length W, where Z = VW. The values of V and W depend on the specific RNG, but are usually larger than 250. Thus, the distance Z between the starting points of two successive streams provided by an RNG usually exceeds 2100. The initial seed of the RNG is the starting point of the first stream. It has a default value for each type of RNG, but this initial value can be changed by calling setPackageSeed for the corresponding class. Each time a new RandomStream is created, its starting point (initial seed) is computed automatically, Z steps ahead of the starting point of the previously created stream of the same type, and its current state is set equal to this starting point.
For each stream, one can advance by one step and generate one value, or go ahead to the beginning of the next substream within this stream, or go back to the beginning of the current substream, or to the beginning of the stream, or jump ahead or back by an arbitrary number of steps. Denote by Cg the current state of a stream g, Ig its initial state, Bg the state at the beginning of the current substream, and Ng the state at the beginning of the next substream. The form of the state of a stream depends on its type. For example, the state of a stream of class {@link MRG32k3a} is a vectorof six 32-bit integers represented internally as floating-point numbers (in double).
The methods for manipulating the streams and generating random numbers are implemented differently for each type of RNG. The methods whose formal parameter types do not depend on the RNG type are specified in the interface RandomStream. The others (e.g., for setting the seeds) are given only in the classes that implement the specific RNG types.
Methods for generating random variates from non-uniform distributions are provided in the {@link umontreal.iro.lecuyer.randvar randvar} package.
|
|