Random Numbers

cimba.hwseed()

Return a hardware-derived 64-bit seed.

cimba.seed(value=None)

Initialize the thread-local PRNG and return the seed used.

cimba.current_seed()

Return the seed used for the current thread’s PRNG stream.

cimba.random()

Draw a continuous uniform random variate on [0.0, 1.0].

cimba.random_u64()

Draw a raw uniformly distributed 64-bit pseudo-random bit pattern.

cimba.fmix64(seed, nonce)

Mix a master seed and deterministic nonce into a reproducible 64-bit seed.

cimba.uniform(min, max)
cimba.triangular(min, mode, max)
cimba.normal(mu=0.0, sigma=1.0)
cimba.lognormal(m, s)
cimba.logistic(m, s)
cimba.cauchy(mode, scale)
cimba.exponential(mean)
cimba.erlang(k, mean)
cimba.hypoexponential(means)
cimba.hyperexponential(means, probabilities)
cimba.gamma(shape, scale=1.0)
cimba.beta(a, b, min=0.0, max=1.0)
cimba.pert(min, mode, max)
cimba.pert_mod(min, mode, max, lambda_)
cimba.weibull(shape, scale)
cimba.pareto(shape, mode)
cimba.chi_squared(k)
cimba.f_dist(a, b)
cimba.student_t(v, m=0.0, s=1.0)
cimba.rayleigh(s)
cimba.dice(min, max)
cimba.flip()
cimba.bernoulli(p)
cimba.geometric(p)
cimba.binomial(n, p)
cimba.negative_binomial(m, p)
cimba.pascal(m, p)
cimba.poisson(r)
cimba.loaded_dice(probabilities)

Draw from the named distribution using the current thread’s Cimba PRNG.

class cimba.AliasSampler(probabilities)

Reusable Vose alias sampler for non-uniform discrete probabilities. probabilities must be non-empty, finite, non-negative, and sum to 1.0. Use cimba.loaded_dice() for occasional one-shot draws and AliasSampler when the same probability table is sampled many times.

sample()

Draw one index from the configured probability table.

close()

Destroy the native alias table. Sampling after close raises RuntimeError.