.. _dootle.actions.random: ===================== dootle.actions.random ===================== .. py:module:: dootle.actions.random Functions --------- .. autoapisummary:: dootle.actions.random.rng_fresh dootle.actions.random.rng_spawn dootle.actions.random.rng_job_spawn dootle.actions.random.rng_ints dootle.actions.random.rng_draw dootle.actions.random.rng_shuffle Module Contents =============== .. py:function:: 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) .. py:function:: rng_spawn(spec, state, _rng, num, _update) Spawn independent sub rngs (eg: for passing to job children) .. py:function:: rng_job_spawn(spec, state, _rng, _onto) For n generated subtasks, spawn n new RNGs and inject them .. py:function:: rng_ints(spec, state, _rng, count, _min, _max, _update) Use the rng to get a count of integers from min to max .. py:function:: 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) .. py:function:: rng_shuffle(spec, state, _rng, base, form, _update) For shuffling and permuting a state value