MiniZinc Documentation - Standard Library

These functions implement random number generators from different probability distributions.

Functions and Predicates
test bernoulli(float: p)

Return a boolean sample from the Bernoulli distribution defined by probability \({\bf p}\)

function int: binomial(int: t, float: p)

Return a sample from the binomial distribution defined by sample number t and probability p

function float: cauchy(float: mean, float: scale)

Return a sample from the cauchy distribution defined by \({\bf mean}, {\bf scale}\)

function float: cauchy(int: mean, float: scale)

Return a sample from the cauchy distribution defined by \({\bf mean}, {\bf scale}\)

function float: chisquared(int: n)

Return a sample from the chi-squared distribution defined by the degree of freedom \({\bf n}\)

function float: chisquared(float: n)

Return a sample from the chi-squared distribution defined by the degree of freedom \({\bf n}\)

function int: discrete_distribution(array [int] of int: weights)

Return a sample from the discrete distribution defined by the array of weights \({\bf weights}\) that assigns a weight to each integer starting from zero

function float: exponential(int: lambda)

Return a sample from the exponential distribution defined by \({\bf lambda}\)

function float: exponential(float: lambda)

Return a sample from the exponential distribution defined by \({\bf lambda}\)

function float: fdistribution(float: d1, float: d2)

Return a sample from the Fisher-Snedecor F-distribution defined by the degrees of freedom \({\bf d1}, {\bf d2}\)

function float: fdistribution(int: d1, int: d2)

Return a sample from the Fisher-Snedecor F-distribution defined by the degrees of freedom \({\bf d1}, {\bf d2}\)

function float: gamma(float: alpha, float: beta)

Return a sample from the gamma distribution defined by \({\bf alpha}, {\bf beta}\)

function float: gamma(int: alpha, float: beta)

Return a sample from the gamma distribution defined by \({\bf alpha}, {\bf beta}\)

function float: lognormal(float: mean, float: std)

Return a sample from the lognormal distribution defined by \({\bf mean}, {\bf std}\)

function float: lognormal(int: mean, float: std)

Return a sample from the lognormal distribution defined by \({\bf mean}, {\bf std}\)

function float: normal(float: mean, float: std)

Return a sample from the normal distribution defined by \({\bf mean}, {\bf std}\)

function float: normal(int: mean, float: std)

Return a sample from the normal distribution defined by \({\bf mean}, {\bf std}\)

function int: poisson(float: mean)

Return a sample from the poisson distribution defined by mean

function int: poisson(int: mean)

Return a sample from the poisson distribution defined by an integer mean

function float: tdistribution(float: n)

Return a sample from the student's t-distribution defined by the sample size \({\bf n}\)

function float: tdistribution(int: n)

Return a sample from the student's t-distribution defined by the sample size \({\bf n}\)

function float: uniform(float: lowerbound, float: upperbound)

Return a sample from the uniform distribution defined by \({\bf lowerbound}, {\bf upperbound}\)

function int: uniform(int: lowerbound, int: upperbound)

Return a sample from the uniform distribution defined by \({\bf lowerbound}, {\bf upperbound}\)

function float: weibull(float: shape, float: scale)

Return a sample from the Weibull distribution defined by \({\bf shape}, {\bf scale}\)

function float: weibull(int: shape, float: scale)

Return a sample from the Weibull distribution defined by \({\bf shape}, {\bf scale}\)