Function cmb_random_triangular

Function Documentation

double cmb_random_triangular(double min, double mode, double max)

Triangular distribution on the interval [min, max] with peak at mode, where min < mode < max.

The probability density function is zero at min and max, and reaches a maximum of 2 / (max - min) at mode. The mean is (min + mode + max) / 3.

Used as an empirical “I don’t know much about the shape of this thing” distribution. Also consider the PERT distributions cmb_random_PERT() and cmb_random_PERT_mod() or the scaled beta distribution cmb_random_beta() for this purpose.

See also https://en.wikipedia.org/wiki/Triangular_distribution