Comment on page
random
Library to generate random numbers. Supports various different distribution types.
Represents the type of distribution to use to generate a random number
enum Distribution : u8 {
Bernoulli,
Binomial,
Cauchy,
ChiSquared,
Exponential,
ExtremeValue,
FisherF,
Gamma,
Geometric,
LogNormal,
NegativeBinomial,
Normal,
Poisson,
StudentT,
Uniform,
Weibull
};
Sets the seed of the random number generator
seed
: Seed to use
fn set_seed(u64 seed);
Generates a random number using the given distribution with the given parameters. The random number generator used internally is C++'s std::mt19937_64 Mersenne Twister implementation.
Distributions
Uniform(min, max) -> i128
Normal(mean, stddev) -> double
Exponential(lambda) -> double
Gamma(alpha, beta) -> double
Weibull(a, b) -> double
ExtremeValue(a, b) -> double
ChiSquared(n) -> double
Cauchy(a, b) -> double
FisherF(m, n) -> double
StudentT(n) -> double
LogNormal(m, s) -> double
Bernoulli(p) -> bool
Binomial(t, p) -> i128
NegativeBinomial(k, p) -> i128
Geometric(p) -> i128
Poisson(mean) -> i128
distribution
: Distribution to useparam1
: This parameter depends on the type of distribution used.param2
: This parameter depends on the type of distribution used.
fn generate_using(std::random::Distribution distribution, auto param1, auto param2);
Generates a uniformly distributed random number between
min
and max
min
: Minimum numbermax
: Maximum number
fn generate(u64 min, u64 max);
Last modified 8mo ago