dootle.actions.random

Functions

rng_fresh(spec, state, seed, seed_path)

Create a new (maybe seeded) random number generator,

rng_spawn(spec, state, _rng, num, _update)

Spawn independent sub rngs (eg: for passing to job children)

rng_job_spawn(spec, state, _rng, _onto)

For n generated subtasks, spawn n new RNGs and inject them

rng_ints(spec, state, _rng, count, _min, _max, _update)

Use the rng to get a count of integers from min to max

rng_draw(spec, state, _rng, dist, shape, args, _update)

Use the rng to draw from a distribution

rng_shuffle(spec, state, _rng, base, form, _update)

For shuffling and permuting a state value

Module Contents

dootle.actions.random.rng_fresh(spec, state, seed, seed_path)

Create a new (maybe seeded) random number generator, added to state._rng

Uses PCG-64 bitgenerator by default With no seed, or seed = -1, uses secrets.randbits(128)

dootle.actions.random.rng_spawn(spec, state, _rng, num, _update)

Spawn independent sub rngs (eg: for passing to job children)

dootle.actions.random.rng_job_spawn(spec, state, _rng, _onto)

For n generated subtasks, spawn n new RNGs and inject them

dootle.actions.random.rng_ints(
spec,
state,
_rng,
count,
_min,
_max,
_update,
)

Use the rng to get a count of integers from min to max

dootle.actions.random.rng_draw(
spec,
state,
_rng,
dist,
shape,
args,
_update,
)

Use the rng to draw from a distribution Use ‘args’, ‘shape’, and ‘dist’

see https://numpy.org/doc/stable/reference/random/generator.html

Distributions include: - beta(a, b) - binomial(n,p) - chisquare(df) - dirichlet(alpha) - exponential(scale( - f(dfnum, dfden) - gamma(shape, scale) - geometric(p) - logistic(loc, scale) - lognormal(mean, sigma) - multinomial(n, pvals) - normal(loc, scale) - pareto(a) - poisson(lam) - power(a) - standrd_t(df) - uniform(low, high)

dootle.actions.random.rng_shuffle(
spec,
state,
_rng,
base,
form,
_update,
)

For shuffling and permuting a state value