Triangular probability distribution function.
Triangular(g,min,mode,max)
Generates a random variate following the Triangular probability distribution function. The variate is generated in the interval [min,max] with the desired mode.
The pseudo-code algorithm used for this distribution is:
1. Generate u as U(0,1)
2. If u &le ((mode - min)/(max - min)), return x = min + sqrt(u*(max - min)*(mode - min)). Otherwise, x = max - sqrt((1-u)*(max - min)*(max - mode))
(u,g) := Triangular(g,1,3,6);
function Triangular extends Var; end Triangular;