The Triangular distribution with domain \((a,b)\) and mode \(m\)
has a density proportional to
$$
f(x) \sim (x-a)/(m-a)
$$
for \(a \le x \le m\), and
$$
f(x) \sim (b-x)/(b-m)
$$
for \(m \le x \le b\).
The generation algorithm uses fast numerical inversion. The parameters
lb
and ub
can be used to generate variates from
the Triangular distribution truncated to the interval (lb
,ub
).