random
Documentation for random.
Library to generate random numbers. Supports various different distribution types.
Types
std::random::Distribution
Represents the type of distribution to use to generate a random number
enum Distribution : {
Bernoulli,
Binomial,
Cauchy,
ChiSquared,
Exponential,
ExtremeValue,
FisherF,
Gamma,
Geometric,
LogNormal,
NegativeBinomial,
Normal,
Poisson,
StudentT,
Uniform,
Weibull
};Functions
std::random::set_seed
Sets the seed of the random number generator
seed: Seed to use
fn set_seed( seed);std::random::generate_using
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) -> i128Normal(mean, stddev) -> doubleExponential(lambda) -> doubleGamma(alpha, beta) -> doubleWeibull(a, b) -> doubleExtremeValue(a, b) -> doubleChiSquared(n) -> doubleCauchy(a, b) -> doubleFisherF(m, n) -> doubleStudentT(n) -> doubleLogNormal(m, s) -> doubleBernoulli(p) -> boolBinomial(t, p) -> i128NegativeBinomial(k, p) -> i128Geometric(p) -> i128Poisson(mean) -> i128
distribution: Distribution to use[param1]: This parameter depends on the type of distribution used. Defaults to 0[param2]: This parameter depends on the type of distribution used. Defaults to 0
fn generate_using(std::random::Distribution distribution, param1, param2);std::random::generate
Generates a uniformly distributed random number between min and max
[min]: Minimum number. Defaults to 0[max]: Maximum number. Defaults tou64_max
fn generate( min, max);