nag_rngs_triangular (g05lhc) generates a vector of pseudorandom numbers from a triangular distribution with parameters , and .
The triangular distribution has a PDF (probability density function) that is triangular in profile. The base of the triangle ranges from
and the PDF has a maximum value of
with probability 1; otherwise the triangular distribution has PDF:
One of the initialization functions nag_rngs_init_repeatable (g05kbc)
(for a repeatable sequence if computed sequentially) or nag_rngs_init_nonrepeatable (g05kcc)
(for a non-repeatable sequence) must be called prior to the first call to nag_rngs_triangular (g05lhc).
This example prints five pseudorandom numbers from a triangular distribution with parameters
, generated by a single call to nag_rngs_triangular (g05lhc), after initialization by nag_rngs_init_repeatable (g05kbc)