flopscope.

flopscope.numpy.random.RandomState

flopscope.numpy.random.RandomState[flopscope source]

numpy legacy ``RandomState`` subclass with FLOP-counted sampler methods.

numpy legacy RandomState subclass with FLOP-counted sampler methods.

Mirrors _CountedGenerator for the legacy API: each sampler (randn, normal, uniform, randint, choice, shuffle, permutation, bytes, ...) deducts FLOPs from the active BudgetContext and returns FlopscopeArray. Free methods (seed, get_state, set_state) pass through; everything else raises UnsupportedFunctionError.

Modern code should prefer flopscope.flops.random.default_rng; use this only when porting code that relies on the legacy API.

See also

Examples

>>> import flopscope.numpy as fnp
>>> from flopscope import BudgetContext
>>> rs = fnp.random.RandomState(42)
>>> with BudgetContext(flop_budget=10**6):
... z = rs.randn(10)
>>> type(z).__name__
'FlopscopeArray'