Mean of n uniformly distributed values
Support: [0, 1]
Optionaloptions: { Optionaln?: numberNumber of values to sum
The mean of n uniform values
rng.bates({ n: 6 });
rng.bates(6);
Bates Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Mean of n uniformly distributed values
Support: [0, 1]
Optionaln: numberNumber of values to sum
The mean of n uniform values
rng.bates({ n: 6 });
rng.bates(6);
Bates Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
A version of the bates distribution that returns gaussian normally distributed results, with n acting as a shape parameter.
Number of values to sum
The mean of n uniform values
Bates Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
A version of the bates distribution that returns gaussian normally distributed results, with n acting as a shape parameter.
Optionaloptions: { Optionaln?: numberNumber of values to sum
The mean of n uniform values
Bates Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Probability that random number is less than p, returns 1 or 0.
Support: {0, 1}
Optionaloptions: { Optionalp?: numberThe probability of success, from [0 to 1], default 0.5
1 or 0, depending on if random number was less than p
rng.bernoulli({ p: 0.5 });
rng.bernoulli(0.5);
Bernoulli distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Probability that random number is less than p, returns 1 or 0.
Support: {0, 1}
Optionalp: numberThe probability of success, from [0 to 1], default 0.5
1 or 0, depending on if random number was less than p
rng.bernoulli({ p: 0.5 });
rng.bernoulli(0.5);
Bernoulli distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Beta distribution.
Support: (0, 1)
Optionaloptions: { Optionalalpha?: numberThe alpha parameter of the Beta distribution, must be positive, default 0.5.
Optionalbeta?: numberThe beta parameter of the Beta distribution, must be positive, default 0.5.
A value from the Beta distribution, (0, 1).
rng.beta({ alpha = 0.5, beta = 0.5 })
rng.beta({ alpha = 1, beta = 2 })
rng.beta({ beta = 1 })
NumberValidationError If the input parameters are not valid.
Generates a value from the Beta-binomial distribution.
Support: {0, 1, 2, ..., n}
Optionaloptions: { Optionalalpha?: numberThe alpha parameter of the Beta distribution, default 1, must be positive.
Optionalbeta?: numberThe beta parameter of the Beta distribution, default 1, must be positive.
Optionaln?: numberThe number of trials, default 1, must be positive integer.
The number of successes in n trials, {0, 1, 2, ..., n}
rng.betaBinomial({ alpha = 1, beta = 2, n = 10 })
rng.betaBinomial({ n = 100 })
Beta-binomial distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Binomial distribution.
Probability distribution of getting number of successes of n trials of a boolean trial with probability p
Support: {0, 1, 2, ..., n}
Optionaloptions: { Optionaln?: numberThe number of trials, must be positive integer, default 1.
Optionalp?: numberThe probability of success, must be a number between 0 and 1 inclusive, default 0.5.
The number of successes, {0, 1, 2, ..., n}.
rng.binomial({ n = 1, p = 0.5 });
rng.binomial({ n = 100, p = 0.1 });
Binomial distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Cauchy distribution.
Support: (-∞, +∞)
@example:
rng.cauchy({ median: 2, scale: 1 }) rng.cauchy({ median: 2 }) rng.cauchy({ scale: 1 })
Optionaloptions: { Optionalmedian?: numberThe location parameter (median, sometimes called x0) - default 0.
Optionalscale?: numberThe scale parameter, must be positive - default 1.
A value from the Cauchy distribution (-∞, +∞).
Cauchy Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Chi-squared distribution.
Support: [0, ∞)
@example:
rng.chiSquared({ k: 2 }) rng.chiSquared(2) // Equivalent
Optionaloptions: { Optionalk?: numberThe degrees of freedom, must be a postive integer - default 1.
A value from the Chi-squared distribution [0, ∞).
Chi-squared Distribution - Wikipedia
NumberValidationError If the input parameter is not valid.
Generates a value from the Chi-squared distribution.
Support: [0, ∞)
@example:
rng.chiSquared({ k: 2 }) rng.chiSquared(2) // Equivalent
Optionalk: numberThe degrees of freedom, must be a postive integer - default 1..
A value from the Chi-squared distribution [0, ∞).
Chi-squared Distribution - Wikipedia
NumberValidationError If the input parameter is not valid.
This function uses the inverse transform sampling method to generate an exponentially distributed random variable.
Support: [0, ∞)
Optionaloptions: { Optionalrate?: numberThe rate, must be > 0, default 1
rng.exponential({ rate: 1 });
rng.exponential(1);
Exponential distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
This function uses the inverse transform sampling method to generate an exponentially distributed random variable.
Support: [0, ∞)
Optionalrate: numberThe rate, must be > 0, default 1
rng.exponential({ rate: 1 });
rng.exponential(1);
Exponential distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a random number from the Gamma distribution.
Support: (0, ∞)
Optionaloptions: { Optionalrate?: numberThe rate parameter, must be postive, default 1.
Optionalscale?: numberThe scale parameter, must be postive, ( = 1/rate).
Optionalshape?: numberThe shape parameter, must be postive, default 1.
A random number from the Gamma distribution, from (0, ∞).
rng.gamma({ shape = 0.5, rate = 0.5 })
rng.gamma({ shape = 0.5, scale = 2 })
rng.gamma({ shape = 0.5, rate = 0.5, scale = 2 }) // Redundant as scale = 1 / rate
rng.gamma({ shape = 0.5, rate = 2, scale = 2 }) // Error('Cannot supply scale and rate')
If both scale and rate are given and are not reciprocals of each other
NumberValidationError If the input parameters are not valid.
Generates a value from the Hermite distribution.
Support: {0, 1, 2, 3, ...}
@example:
rng.hermite({ lambda1: 1, lambda2: 2 }) rng.hermite({ lambda1: 1 }) rng.hermite({ lambda2: 2 })
Optionaloptions: { Optionallambda1?: numberThe mean of the first Poisson process, must be positive.
Optionallambda2?: numberThe mean of the second Poisson process, must be positive.
A value from the Hermite distribution, {0, 1, 2, 3, ...}
Hermite Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
This function uses combinations to calculate probabilities for the hypergeometric distribution.
The hypergeometric distribution is a discrete probability distribution that describes the probability of k successes (random draws for which the object drawn has a specified feature) in n draws, without replacement, from a finite population of size N that contains exactly K objects with that feature
Support: {max(0, n+K-N), ..., min(n, K)}
Optionaloptions: { Optionalk?: numberThe number of observed successes, must be positive integer lteq K and n.
OptionalK?: numberThe number of successes in the population, must be positive integer lteq N.
Optionaln?: numberThe number of draws, must be positive integer lteq N.
OptionalN?: numberThe population size, must be positive integer.
The probability of exactly k successes in n draws, {max(0, n+K-N), ..., min(n, K)}.
rng.hypergeometric({ N: 50, K: 10, n: 5 });
rng.hypergeometric({ N: 50, K: 10, n: 5, k: 2 });
Hypergeometric distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Sum of n uniformly distributed values
Support: [0, n]
Optionaloptions: { Optionaln?: numberNumber of values to sum
The sum
rng.irwinHall({ n: 6 });
rng.irwinHall(6);
Irwin-Hall Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Sum of n uniformly distributed values
Support: [0, n]
Optionaln: numberNumber of values to sum
The sum
rng.irwinHall({ n: 6 });
rng.irwinHall(6);
Irwin-Hall Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Kumaraswamy distribution.
Support: (0, 1)
@example:
rng.kumaraswamy({ alpha: 1, beta: 2 }) rng.kumaraswamy({ alpha: 1 }) rng.kumaraswamy({ beta: 2 })
Optionaloptions: { Optionalalpha?: numberThe first shape parameter of the Kumaraswamy distribution, must be positive.
Optionalbeta?: numberThe second shape parameter of the Kumaraswamy distribution, must be positive.
A value from the Kumaraswamy distribution, (0, 1).
Kumaraswamy Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Laplace distribution.
Support: (-∞, +∞)
@example:
rng.laplace({ mean: 2, scale: 1 }) rng.laplace({ mean: 2 }) rng.laplace({ scale: 1 })
Optionaloptions: { Optionalmean?: numberThe location parameter (mean) - default 0.
Optionalscale?: numberThe scale parameter, must be positive - default 1.
A value from the Laplace distribution (-∞, +∞).
Laplace Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Logistic distribution.
Support: (-∞, +∞)
@example:
rng.logistic({ mean: 2, scale: 1 }) rng.logistic({ mean: 2 }) rng.logistic({ scale: 1 })
Optionaloptions: { Optionalmean?: numberThe location parameter (mean) - default 0.
Optionalscale?: numberThe scale parameter, must be positive - default 1.
A value from the Logistic distribution (-∞, +∞).
Laplace Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Log-Normal distribution.
Support: (0, ∞)
@example:
rng.logNormal({ mean: 2, stddev: 1 }) rng.logNormal({ mean: 2 }) rng.logNormal({ stddev: 1 })
Optionaloptions: { Optionalmean?: numberThe mean of the underlying normal distribution - default 0.
Optionalstddev?: numberThe standard deviation of the underlying normal distribution, must be positive - default 1.
A value from the Log-Normal distribution (0, ∞).
Log Normal Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Generalized Pareto distribution.
Support: [scale, ∞)
Optionaloptions: { Optionallocation?: numberThe location parameter, default 0.
Optionalscale?: numberThe scale parameter, must be positive ( > 0), default 1.
Optionalshape?: numberThe shape parameter, must be >= 0, default 0.5.
A value from the Generalized Pareto distribution, [scale, ∞).
rng.pareto({ shape: 0.5, scale: 1, location: 0 });
rng.pareto({ location: 0 });
rng.pareto({ scale: 1 });
rng.pareto({ shape: 0.5 });
Pareto distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
This function uses the fact that the Poisson distribution can be generated using a series of random numbers multiplied together until their product is less than e^(-lambda). The number of terms needed is the Poisson-distributed random variable.
Support: {1, 2, 3 ...}
Optionaloptions: { Optionallambda?: numberControl parameter, must be positive, default 1.
Poisson distributed random number, {1, 2, 3 ...}
rng.poisson({ lambda: 1 });
rng.poisson(1);
Poisson distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
This function uses the fact that the Poisson distribution can be generated using a series of random numbers multiplied together until their product is less than e^(-lambda). The number of terms needed is the Poisson-distributed random variable.
Support: {1, 2, 3 ...}
Optionallambda: numberControl parameter, must be positive, default 1.
Poisson distributed random number, {1, 2, 3 ...}
rng.poisson({ lambda: 1 });
rng.poisson(1);
Poisson distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Rayleigh distribution
Support: [0, ∞)
@example:
rng.rayleigh({ scale: 2 }) rng.rayleigh(2) // Equivalent
Optionaloptions: { Optionalscale?: numberThe scale parameter of the Rayleigh distribution, must be > 0 - default 1.
A value from the Rayleigh distribution [0, ∞).
Rayleigh Distribution - Wikipedia
NumberValidationError If the input parameter is not valid.
Generates a value from the Rayleigh distribution
Support: [0, ∞)
@example:
rng.rayleigh({ scale: 2 }) rng.rayleigh(2) // Equivalent
Optionalscale: numberThe scale parameter of the Rayleigh distribution, must be > 0 - default 1.
A value from the Rayleigh distribution [0, ∞).
Rayleigh Distribution - Wikipedia
NumberValidationError If the input parameter is not valid.
Generates a value from the Student's t-distribution.
Support: (-∞, ∞)
@example:
rng.studentsT({ nu: 10 }) rng.studentsT(10)
Optionaloptions: { Optionalnu?: numberThe degrees of freedom, default 1, must be positive.
A value from the Student's t-distribution, (-∞, ∞).
Student's t-distribution - Wikipedia
NumberValidationError If the input parameter is not valid.
Generates a value from the Student's t-distribution.
Support: (-∞, ∞)
@example:
rng.studentsT({ nu: 10 }) rng.studentsT(10)
Optionalnu: numberThe degrees of freedom, must be positive, default 1
A value from the Student's t-distribution, (-∞, ∞).
Student's t-distribution - Wikipedia
NumberValidationError If the input parameter is not valid.
Generates a value from the Wigner semicircle distribution.
Support: [-R; +R]
@example:
rng.wignerSemicircle({ R: 1 }) rng.wignerSemicircle(1)
Optionaloptions: { OptionalR?: numberThe radius of the semicircle, must be positive, default 1.
A value from the Wigner semicircle distribution, [-R; +R].
Wigner Semicircle Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
Generates a value from the Wigner semicircle distribution.
Support: [-R; +R]
@example:
rng.wignerSemicircle({ R: 1 }) rng.wignerSemicircle(1)
OptionalR: numberThe radius of the semicircle, must be positive, default 1.
A value from the Wigner semicircle distribution, [-R; +R].
Wigner Semicircle Distribution - Wikipedia
NumberValidationError If the input parameters are not valid.
A version of RngInterface that includes lots of extra distributions.
Depending on your integration, you may not need this.