You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

exp_dist

exp_dist() Returns a random value with exponential distribution.

exp_dist(m)
Returns a random number with exponential distribution.
COPY/// @func   exp_dist(m)
///
/// @desc   Returns a random number with exponential distribution.
///
/// @param  {real}      m           mean value of the distribution
///
/// @return {real}      random number
///
/// GMLscripts.com/license

function exp_dist(m)
{
    return -m * ln(1-random(1));
}

Contributors: pedrosoriom, xot

GitHub: View · Commits · Blame · Raw