Mean of n uniformly distributed values
Support: [0, 1]
Optional
options: { Optional
n?: numberNumber of values to sum
The mean of n uniform values
NumberValidationError If the input parameters are not valid.
Mean of n uniformly distributed values
Support: [0, 1]
Optional
n: numberNumber of values to sum
The mean of n uniform values
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
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.
Optional
options: { Optional
n?: numberNumber of values to sum
The mean of n uniform values
NumberValidationError If the input parameters are not valid.
Probability that random number is less than p, returns 1 or 0.
Support: {0, 1}
Optional
options: { Optional
p?: numberThe probability of success, from [0 to 1], default 0.5
1 or 0, depending on if random number was less than p
NumberValidationError If the input parameters are not valid.
Probability that random number is less than p, returns 1 or 0.
Support: {0, 1}
Optional
p: numberThe probability of success, from [0 to 1], default 0.5
1 or 0, depending on if random number was less than p
NumberValidationError If the input parameters are not valid.
Generates a value from the Beta distribution.
Support: (0, 1)
Optional
options: { Optional
alpha?: numberThe alpha parameter of the Beta distribution, must be positive, default 0.5.
Optional
beta?: numberThe beta parameter of the Beta distribution, must be positive, default 0.5.
A value from the Beta distribution, (0, 1).
NumberValidationError If the input parameters are not valid.
Generates a value from the Beta-binomial distribution.
Support: {0, 1, 2, ..., n}
Optional
options: { Optional
alpha?: numberThe alpha parameter of the Beta distribution, default 1, must be positive.
Optional
beta?: numberThe beta parameter of the Beta distribution, default 1, must be positive.
Optional
n?: numberThe number of trials, default 1, must be positive integer.
The number of successes in n trials, {0, 1, 2, ..., n}
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}
Optional
options: { Optional
n?: numberThe number of trials, must be positive integer, default 1.
Optional
p?: numberThe probability of success, must be a number between 0 and 1 inclusive, default 0.5.
The number of successes, {0, 1, 2, ..., n}.
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 })
Optional
options: { Optional
median?: numberThe location parameter (median, sometimes called x0) - default 0.
Optional
scale?: numberThe scale parameter, must be positive - default 1.
A value from the Cauchy distribution (-∞, +∞).
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
Optional
options: { Optional
k?: numberThe degrees of freedom, must be a postive integer - default 1.
A value from the Chi-squared distribution [0, ∞).
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
Optional
k: numberThe degrees of freedom, must be a postive integer - default 1..
A value from the Chi-squared distribution [0, ∞).
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, ∞)
Optional
options: { Optional
rate?: numberThe rate, must be > 0, default 1
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, ∞)
Optional
rate: numberThe rate, must be > 0, default 1
NumberValidationError If the input parameters are not valid.
Generates a random number from the Gamma distribution.
Support: (0, ∞)
Optional
options: { Optional
rate?: numberThe rate parameter, must be postive, default 1.
Optional
scale?: numberThe scale parameter, must be postive, ( = 1/rate).
Optional
shape?: 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')
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 })
Optional
options: { Optional
lambda1?: numberThe mean of the first Poisson process, must be positive.
Optional
lambda2?: numberThe mean of the second Poisson process, must be positive.
A value from the Hermite distribution, {0, 1, 2, 3, ...}
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)}
Optional
options: { Optional
k?: numberThe number of observed successes, must be positive integer lteq K and n.
Optional
K?: numberThe number of successes in the population, must be positive integer lteq N.
Optional
n?: numberThe number of draws, must be positive integer lteq N.
Optional
N?: numberThe population size, must be positive integer.
The probability of exactly k successes in n draws, {max(0, n+K-N), ..., min(n, K)}.
NumberValidationError If the input parameters are not valid.
Sum of n uniformly distributed values
Support: [0, n]
Optional
options: { Optional
n?: numberNumber of values to sum
The sum
NumberValidationError If the input parameters are not valid.
Sum of n uniformly distributed values
Support: [0, n]
Optional
n: numberNumber of values to sum
The sum
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 })
Optional
options: { Optional
alpha?: numberThe first shape parameter of the Kumaraswamy distribution, must be positive.
Optional
beta?: numberThe second shape parameter of the Kumaraswamy distribution, must be positive.
A value from the Kumaraswamy distribution, (0, 1).
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 })
Optional
options: { Optional
mean?: numberThe location parameter (mean) - default 0.
Optional
scale?: numberThe scale parameter, must be positive - default 1.
A value from the Laplace distribution (-∞, +∞).
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 })
Optional
options: { Optional
mean?: numberThe location parameter (mean) - default 0.
Optional
scale?: numberThe scale parameter, must be positive - default 1.
A value from the Logistic distribution (-∞, +∞).
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 })
Optional
options: { Optional
mean?: numberThe mean of the underlying normal distribution - default 0.
Optional
stddev?: numberThe standard deviation of the underlying normal distribution, must be positive - default 1.
A value from the Log-Normal distribution (0, ∞).
NumberValidationError If the input parameters are not valid.
Generates a value from the Generalized Pareto distribution.
Support: [scale, ∞)
Optional
options: { Optional
location?: numberThe location parameter, default 0.
Optional
scale?: numberThe scale parameter, must be positive ( > 0), default 1.
Optional
shape?: 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 });
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 ...}
Optional
options: { Optional
lambda?: numberControl parameter, must be positive, default 1.
Poisson distributed random number, {1, 2, 3 ...}
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 ...}
Optional
lambda: numberControl parameter, must be positive, default 1.
Poisson distributed random number, {1, 2, 3 ...}
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
Optional
options: { Optional
scale?: numberThe scale parameter of the Rayleigh distribution, must be > 0 - default 1.
A value from the Rayleigh distribution [0, ∞).
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
Optional
scale: numberThe scale parameter of the Rayleigh distribution, must be > 0 - default 1.
A value from the Rayleigh distribution [0, ∞).
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)
Optional
options: { Optional
nu?: numberThe degrees of freedom, default 1, must be positive.
A value from the Student's t-distribution, (-∞, ∞).
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)
Optional
nu: numberThe degrees of freedom, must be positive, default 1
A value from the Student's t-distribution, (-∞, ∞).
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)
Optional
options: { Optional
R?: numberThe radius of the semicircle, must be positive, default 1.
A value from the Wigner semicircle distribution, [-R; +R].
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)
Optional
R: numberThe radius of the semicircle, must be positive, default 1.
A value from the Wigner semicircle distribution, [-R; +R].
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.