nag_rand_skip_ahead_power2 (g05kkc) allows for the generation of multiple, independent, sequences of pseudorandom numbers using the skip-ahead method. The base pseudorandom number sequence defined by
state is advanced
places.
nag_rand_skip_ahead_power2 (g05kkc) adjusts a base generator to allow multiple, independent, sequences of pseudorandom numbers to be generated via the skip-ahead method (see the
g05 Chapter Introduction for details).
If, prior to calling
nag_rand_skip_ahead_power2 (g05kkc) the base generator defined by
state would produce random numbers
, then after calling
nag_rand_skip_ahead_power2 (g05kkc) the generator will produce random numbers
.
One of the initialization functions
nag_rand_init_repeatable (g05kfc) (for a repeatable sequence if computed sequentially) or
nag_rand_init_nonrepeatable (g05kgc) (for a non-repeatable sequence) must be called prior to the first call to
nag_rand_skip_ahead_power2 (g05kkc).
The skip-ahead algorithm can be used in conjunction with any of the six base generators discussed in the
g05 Chapter Introduction.
Haramoto H, Matsumoto M, Nishimura T, Panneton F and L'Ecuyer P (2008) Efficient jump ahead for F2-linear random number generators INFORMS J. on Computing 20(3) 385–390
Not applicable.
Calling
nag_rand_skip_ahead_power2 (g05kkc) and then generating a series of uniform values using
nag_rand_basic (g05sac) is equivalent to, but more efficient than, calling
nag_rand_basic (g05sac) and discarding the first
values. This may not be the case for distributions other than the uniform, as some distributional generators require more than one uniform variate to generate a single draw from the required distribution.
This example initializes a base generator using
nag_rand_init_repeatable (g05kfc) and then uses
nag_rand_skip_ahead_power2 (g05kkc) to advance the sequence
places before generating five variates from a uniform distribution using
nag_rand_basic (g05sac).