ecotyper.rcompat.rng¶
R’s default random number generator (Mersenne-Twister + Rejection sampling).
This reproduces, draw for draw, set.seed(), unif_rand(), runif() and
sample()/sample.int() of R >= 3.6 with the default
RNGkind("Mersenne-Twister", "Inversion", "Rejection") (see R’s
src/main/RNG.c and src/main/random.c).
Classes
|
Stateful emulation of R's RNG ( |
- class ecotyper.rcompat.rng.RRandom(seed=None)[source]¶
Bases:
objectStateful emulation of R’s RNG (
.Random.seed).- Parameters:
seed (int | None)
- set_seed(seed)[source]¶
set.seed(seed)(seedis coerced likeas.integer).- Parameters:
seed (int)
- Return type:
None
- sample_int(n, size=None, replace=False)[source]¶
sample.int(n, size, replace); returns 1-based integers like R.