The EbsScript unit @Random contains functions for generating various random distributions, among others
Name |
Purpose |
Arguments |
Return value |
Example |
rndUniformIntegerDistribution |
Function generates a uniformly distributed integer random number in the range [minimum, maximum] |
1: INTEGER: minimum |
INTEGER: |
|
rndUniformRealDistribution
|
Function generates a uniformly distributed real random number in the range [minimum, maximum] |
1: REAL: minimum |
REAL: |
|
rndNormalDistribution
|
Function generates a normally distributed real random number with the mean value mean and standard deviation stddef |
1: REAL: mean
|
REAL: |
The functions are based on the corresponding C++ classes (see http://en.cppreference.com/w/cpp/numeric/random ) and they all use a 64-bit Mersenne Twister algorithm (mt19937_64 by Matsumoto and Nishimura, 2000) as generator.
The complete list comprises:
Uniform distributions:
function rndUniformIntegerDistribution(minimum:integer = 0; maximum:integer = 2147483647):integer; internal;
function rndUniformRealDistribution(minimum:real = 0; maximum:real = 1):real; internal;
Bernoulli distributions:
function rndBernoulliDistribution(p_true:real = 0.5):Boolean; internal;
function rndBinomialDistribution(trials:integer = 1; p_true:real = 0.5):integer; internal;
function rndnegativeBinomialDistribution(fail_trials:integer = 1; p_true:real = 0.5):integer; internal;
function rndGeometricDistribution(p_true:real = 0.5):integer; internal;
Poisson distributions:
function rndPoissonDistribution(mean:real = 1.0):integer; internal;
function rndExponentialDistribution(lambda:real = 1.0):real; internal;
function rndGammaDistribution(alpha:real = 1.0; beta:real = 1.0):real; internal;
function rndWeibullDistribution(a:real = 1.0; b:real = 1.0):real; internal;
function rndExtremeValueDistribution(a:real = 0.0; b:real = 1.0):real; internal;
Normal distributions:
function rndNormalDistribution(mean:real = 0.0; stddev:real = 1.0):real; internal;
function rndLognormalDistribution(m:real = 0.0; shape:real = 1.0):real; internal;
function rndChiSquaredDistribution(n:real = 1.0):real; internal;
function rndCauchyDistribution(a:real = 0.0; b:real = 1.0):real; internal;
function rndFisherFDistribution(m:real = 1.0; n:real = 1.0):real; internal;
function rndStudentTDistribution(n:real = 1.0):real; internal;