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

Invert GMLscripts.com

ds_list_mean

$$\large \bar{x}=\frac{\Sigma{x}}{n}\quad\Sigma{x}=x_1+x_2+\cdots+x_n$$

ds_list_mean(id)
Returns the mean (average) of the values in a given list.
COPY/// ds_list_mean(id)
//
//  Returns the mean (average) of the values in a given list.
//
//      id          list data structure, real
//
/// GMLscripts.com/license
{
    var i,j,k;
    j = 0;
    k = ds_list_size(argument0);
    for (i=0; i<k; i+=1) j += ds_list_find_value(argument0, i);
    return (j / k);
}

Contributors: xot

GitHub: View · Commits · Blame · Raw