Title: | Toolbox for WELL Random Number Generators |
---|---|
Description: | It is a dedicated package to WELL pseudo random generators, which were introduced in Panneton et al. (2006), ``Improved Long-Period Generators Based on Linear Recurrences Modulo 2'', see <doi:10.1145/1132973.1132974>. But this package is not intended to be used directly, you are strongly __encouraged__ to use the 'randtoolbox' package, which depends on this package. |
Authors: | Christophe Dutang [aut, cre] , Petr Savicky [aut], F. Panneton [ctb] (C Code), P. L'Ecuyer [ctb] (C Code), M. Matsumoto [ctb] (C Code) |
Maintainer: | Christophe Dutang <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 0.10-10 |
Built: | 2024-11-17 03:23:25 UTC |
Source: | https://github.com/cran/rngWELL |
General linear congruential generators such as Park Miller sequence, generalized feedback shift register such as SF-Mersenne Twister algorithm and WELL generator; and a quasi random generator (pseudo random generators) and the Torus algorithm (quasi random generation).
WELL2test(n, dim = 1, order = 512, temper = FALSE, version = "a") setSeed4WELL(seed) doinitMT2002(seed, n, state) doputRngWELL(order, version, state) dogetRngWELL(order, version, state)
WELL2test(n, dim = 1, order = 512, temper = FALSE, version = "a") setSeed4WELL(seed) doinitMT2002(seed, n, state) doputRngWELL(order, version, state) dogetRngWELL(order, version, state)
n |
number of observations. If length(n) > 1, the length is taken to be the required number. |
dim |
dimension of observations (must be <=100 000, default 1). |
seed |
a single value, interpreted as a positive integer for the seed. e.g. append your day, your month and your year of birth. |
order |
a positive integer for the order of the characteristic polynomial. see details |
temper |
a logical if you want to do a tempering stage. see details |
version |
a character either |
state |
the state as output of |
The currently available generator are given below.
The WELL (which stands for Well Equidistributed Long-period Linear) is in a sentence a generator with better equidistribution than Mersenne Twister algorithm but this gain of quality has to be paid by a slight higher cost of time. See Panneton et al. (2006) for details.
The order
argument of WELL
generator is the order of the characteristic polynomial, which is denoted by in
Paneton F., L'Ecuyer P. and Matsumoto M. (2006). Possible values for
order
are 512, 521, 607, 1024 where no tempering are needed (thus possible).
Order can also be 800, 19937, 21071, 23209, 44497 where a tempering stage
is possible through the temper
argument.
Furthermore a possible 'b' version of WELL RNGs are possible for the
following order 521, 607, 1024, 800, 19937, 23209 with the version
argument.
All the C code for WELL generator used in this package is the code of P. L'Ecuyer (cf. http://www.iro.umontreal.ca/~lecuyer/), except some C code, we add, to interface with R.
See the pdf vignette for details.
WELL2test
generates random variables in [0,1[. It returns a x
matrix, when
dim
>1 otherwise a vector of length n
.
setSeed4WELL
set the seed of the rngWELL
package
(i.e. for the WELL2test
functions).
Christophe Dutang and Petr Savicky
Paneton F., L'Ecuyer P. and Matsumoto M. (2006), Improved Long-Period Generators Based on Linear Recurrences Modulo 2, ACM Transactions on Mathematical Software. (preprint available online)
.Random.seed
for what is done in R about random number generation.
# (1) WELL generator # # 'basic' calls # WELL512 WELL2test(10, order = 512) # WELL1024 WELL2test(10, order = 1024) # WELL19937 WELL2test(10, order = 19937) # WELL44497 WELL2test(10, order = 44497) # WELL19937 with tempering WELL2test(10, order = 19937, temper = TRUE) # WELL44497 with tempering WELL2test(10, order = 44497, temper = TRUE) # tempering vs no tempering setSeed4WELL(08082008) WELL2test(10, order =19937) setSeed4WELL(08082008) WELL2test(10, order =19937, temper=TRUE) # (2) other tests # doinitMT2002(1, 10, 10)
# (1) WELL generator # # 'basic' calls # WELL512 WELL2test(10, order = 512) # WELL1024 WELL2test(10, order = 1024) # WELL19937 WELL2test(10, order = 19937) # WELL44497 WELL2test(10, order = 44497) # WELL19937 with tempering WELL2test(10, order = 19937, temper = TRUE) # WELL44497 with tempering WELL2test(10, order = 44497, temper = TRUE) # tempering vs no tempering setSeed4WELL(08082008) WELL2test(10, order =19937) setSeed4WELL(08082008) WELL2test(10, order =19937, temper=TRUE) # (2) other tests # doinitMT2002(1, 10, 10)