4.2.1.10. Random Number Generator builtins

These functions implement random number generators from different probability distributions.

In this section: bernoulli, binomial, cauchy, chisquared, discrete_distribution, exponential, fdistribution, gamma, lognormal, normal, poisson, tdistribution, uniform, weibull.

bernoulli

test bernoulli(float: p)

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

binomial

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

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

cauchy

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

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

chisquared

function float: chisquared(int: n)
function float: chisquared(float: n)

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

discrete_distribution

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

exponential

function float: exponential(int: lambda)
function float: exponential(float: lambda)

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

fdistribution

function float: fdistribution(float: d1, float: 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}\)

gamma

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

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

lognormal

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

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

normal

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

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

poisson

1.  function int: poisson(float: mean)

2.  function int: poisson(int: mean)
  1. Return a sample from the poisson distribution defined by mean

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

tdistribution

function float: tdistribution(float: n)
function float: tdistribution(int: n)

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

uniform

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

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

3.  function int: uniform(set of int: S)
1, 2.

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

  1. Return a sample from the uniform distribution defined by S

weibull

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

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