nag_rand_triangular (g05spc) 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
to
and the PDF has a maximum value of
at
. If
then
with probability 1; otherwise the triangular distribution has PDF:
One of the initialization functions
nag_rand_init_repeatable (g05kfc) (for a repeatable sequence if computed sequentially) or
nag_rand_init_nonrepeatable (g05kgc) (for a non-repeatable sequence) must be called prior to the first call to nag_rand_triangular (g05spc).
Not applicable.
nag_rand_triangular (g05spc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
None.
This example prints five pseudorandom numbers from a triangular distribution with parameters
,
and
, generated by a single call to nag_rand_triangular (g05spc), after initialization by
nag_rand_init_repeatable (g05kfc).
None.