pract_rng() tests the generator behind runif(), as chosen by
RNGkind(), with its own bits wherever they can be recovered: the 32-bit
integers of Mersenne-Twister, Marsaglia-Multicarry, Super-Duper and
L'Ecuyer-CMRG, and the 30-bit integers of the Knuth generators, packed
into a continuous bit stream. Wichmann-Hill, which adds three fractions,
and user-supplied generators are tested on the 32 most significant bits
of each number.
Arguments
- kind
The generator, as named by
RNGkind().- seed
The seed passed to
set.seed(): a whole number of at most.Machine$integer.maxin absolute value.
Details
The source draws from its own copy of the generator's state, set with
RNGkind(kind) and set.seed(seed): the session's .Random.seed and
kind are restored after every draw, so testing does not change the random
numbers the session draws, and several pract_rng() sources, for example
two seeds in pract_interleave(), each keep their own stream.
A user-supplied generator (Random.user) keeps its state in its own
code. R copies that state into .Random.seed only when the generator
provides user_unif_nseed and user_unif_seedloc, so only then can the
source keep a stream of its own. Without them, set.seed() and the
draws act on the generator the session uses: testing it changes the
session's stream, and two such sources share one stream.
See also
Other sources:
pract_interleave(),
pract_raw()
Examples
pract_test(pract_rng("Mersenne-Twister"), min_bytes = 2^16, max_bytes = 2^17)
#> PractRand 0.96 test of R's Mersenne-Twister generator (seed 1), its 32-bit integers
#> length= 64 kilobytes (2^16 bytes)
#> no anomalies in 47 test result(s)
#> length= 128 kilobytes (2^17 bytes)
#> no anomalies in 56 test result(s)
#> No failure, time= 0.3 seconds