.DESLib.RandomLib.Variates.Continuous.Triangular

Information

Triangular

Triangular probability distribution function.

Syntax

Triangular(g,min,mode,max)

Description

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))

Examples

  (u,g) := Triangular(g,1,3,6);

Interface

function Triangular
  extends Var;
end Triangular;

Generated at 2024-11-21T19:25:40Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos