naginterfaces.library.rand.init_skipahead(n, statecomm)[source]

init_skipahead 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.

For full information please refer to the NAG Library document for g05kj

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g05/g05kjf.html

Parameters
nint

, the number of places to skip ahead.

statecommdict, RNG communication object, modified in place

RNG communication structure.

This argument must have been initialized by a prior call to init_repeat() or init_nonrepeat().

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, [‘state’] vector has been corrupted or not initialized.

(errno )

On entry, cannot use skip-ahead with the base generator defined by [‘state’].

(errno )

On entry, the base generator is Mersenne Twister, but the [‘state’] vector defined on initialization is not large enough to perform a skip ahead. See the initialization function init_repeat() or init_nonrepeat().

Notes

init_skipahead adjusts a base generator to allow multiple, independent, sequences of pseudorandom numbers to be generated via the skip-ahead method (see the G05 Introduction for details).

If, prior to calling init_skipahead the base generator defined by [‘state’] would produce random numbers , then after calling init_skipahead the generator will produce random numbers .

One of the initialization functions init_repeat() (for a repeatable sequence if computed sequentially) or init_nonrepeat() (for a non-repeatable sequence) must be called prior to the first call to init_skipahead.

The skip-ahead algorithm can be used in conjunction with any of the six base generators discussed in submodule rand.

References

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

Knuth, D E, 1981, The Art of Computer Programming (Volume 2), (2nd Edition), Addison–Wesley