naginterfaces.library.rand.init_repeat¶
- naginterfaces.library.rand.init_repeat(genid, seed, subid=0)[source]¶
init_repeat
initializes the selected base generator, as used by the group of pseudorandom number functions (seeinit_leapfrog()
–init_skipahead()
,permute()
,sample()
,times_garch_asym1()
–times_mv_varma()
,matrix_orthog()
–matrix_2waytable()
,copula_students_t()
,copula_normal()
,multivar_students_t()
,multivar_normal()
anddist_uniform01()
–int_uniform()
) and the quasi-random scrambled sequence initialization function,quasi_init_scrambled()
.For full information please refer to the NAG Library document for g05kf
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g05/g05kff.html
- Parameters
- genidint
Must contain the type of base generator to use.
NAG basic generator.
Wichmann Hill I generator.
Mersenne Twister.
Wichmann Hill II generator.
ACORN generator.
L’Ecuyer MRG32k3a generator.
See the G05 Introduction for details of each of the base generators.
- seedint, array-like, shape
The initial (seed) values for the selected base generator. The number of initial values required varies with each of the base generators.
If , one seed is required.
If , four seeds are required.
If , seeds are required.
If , four seeds are required.
If , seeds are required, where and are defined by .
For the ACORN generator it is recommended that an odd value is used for .
If , six seeds are required.
If insufficient seeds are provided then the first values supplied in are used and the remaining values are randomly generated using the NAG basic generator.
In such cases the NAG basic generator is initialized using the value supplied in .
- subidint, optional
If , indicates which of the sub-generators to use. In this case, the sub-generator is used.
If , indicates the values of and to use, where is the order of the generator, and controls the size of the modulus, , with .
If , the default values of and are used, otherwise values for and are calculated from the formula, .
If and the range of the generator is set to , otherwise the range is set to ; in this case the sequence is identical to the implementation of MRG32k3a in TestU01 (see L’Ecuyer and Simard (2002)) for identical seeds.
For all other values of , is not referenced.
- Returns
- statecommdict, RNG communication object
RNG communication structure.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: , , , , or .
- (errno )
On entry, invalid .
- (errno )
On entry, .
Constraint: .
- Notes
init_repeat
selects a base generator through the input value of the arguments and , and then initializes it based on the values given in the array .A given base generator will yield different sequences of random numbers if initialized with different values of . Alternatively, the same sequence of random numbers will be generated if the same value of is used. It should be noted that there is no guarantee of statistical properties between sequences, only within sequences.
A definition of some of the terms used in this description, along with details of the various base generators can be found in the G05 Introduction.
- References
L’Ecuyer, P and Simard, R, 2002, TestU01: a software library in ANSI C for empirical testing of random number generators, Departement d’Informatique et de Recherche Operationnelle, Universite de Montreal, https://www.iro.umontreal.ca/~lecuyer
Maclaren, N M, 1989, The generation of multiple independent sequences of pseudorandom numbers, Appl. Statist. (38), 351–359
Matsumoto, M and Nishimura, T, 1998, Mersenne twister: a 623-dimensionally equidistributed uniform pseudorandom number generator, ACM Transactions on Modelling and Computer Simulations
Wichmann, B A and Hill, I D, 2006, Generating good pseudo-random numbers, Computational Statistics and Data Analysis (51), 1614–1622
Wikramaratna, R S, 1989, ACORN - a new method for generating sequences of uniformly distributed pseudo-random numbers, Journal of Computational Physics (83), 16–31