Random
Random number generation from mechestim.random. Sampling operations are counted — each sample costs numel(output) FLOPs, and shuffle/permutation costs n * ceil(log2(n)) FLOPs. Only configuration helpers (seed, get_state, set_state, default_rng) are free (0 FLOPs).
mechestim.random
Counted wrappers for numpy.random.
Most samplers deduct numel(output) FLOPs from the active budget.
Shuffle-like operations (permutation, shuffle, choice without
replacement) deduct n * ceil(log2(n)) FLOPs.
Configuration helpers (seed, get_state, set_state,
default_rng, RandomState) are free.
Any attribute not listed here is forwarded to numpy.random via
__getattr__ without budget deduction.
bytes(length)
Counted version of numpy.random.bytes.
Cost: length FLOPs.
Source code in src/mechestim/random/__init__.py
choice(a, size=None, replace=True, p=None)
Counted version of numpy.random.choice.
Cost: numel(output) FLOPs if replace=True;
sort_cost(n) = n * ceil(log2(n)) FLOPs if replace=False.
Source code in src/mechestim/random/__init__.py
permutation(x)
Counted version of numpy.random.permutation.
Cost: sort_cost(n) = n * ceil(log2(n)) FLOPs.
Source code in src/mechestim/random/__init__.py
shuffle(x, axis=0)
Counted version of numpy.random.shuffle.
Modifies x in-place. Cost: sort_cost(n) = n * ceil(log2(n)) FLOPs.