|
NAG[g05eyc] NAG[nag_return_discrete] - Pseudo-random integer from reference vector
|
|
Calling Sequence
g05eyc(r)
nag_return_discrete(. . .)
Parameters
|
r - float;
|
|
|
On entry: the reference vector for which memory has been allocated by a previous call to another g05 function. To free this memory the macro NAG_FREE should be added in the users' program after the final call to nag_return_discrete (g05eyc).
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_return_discrete (g05eyc) returns a pseudo-random integer taken from a discrete distribution defined by a reference vector r.
|
|
Description
|
|
nag_return_discrete (g05eyc) is designed for use in conjunction with other functions in this chapter, which set up the reference vector r for specific distributions or according to a distribution specified in terms of the PDF (probability density function) or CDF (cumulative distribution function). See the g05 Chapter Introduction.
The function generates a random number from g05cac (nag_random_continuous_uniform) and searches the CDF in r for the smallest value such that CDF and CDF .
|
|
Error Indicators and Warnings
|
|
|
|
|
Examples
|
|
>
|
t := 2.7:
NAG:-g05cbc(0):
NAG:-g05ecc(t, r):
x := Vector(5):
for i from 1 to 5 do
x[i] := NAG:-g05eyc(r):
end do:
|
|
|
Download Help Document
Was this information helpful?