g05tcc generates
integers
from a discrete geometric distribution, where the probability of
(a first success after
trials) is
The variates can be generated with or without using a search table and index. If a search table is used then it is stored with the index in a reference vector and subsequent calls to g05tcc with the same parameter value can then use this reference vector to generate further variates. If the search table is not used (as recommended for small values of ) then a direct transformation of uniform variates is used.
One of the initialization functions
g05kfc (for a repeatable sequence if computed sequentially) or
g05kgc (for a non-repeatable sequence) must be called prior to the first call to
g05tcc.
Not applicable.
Background information to multithreading can be found in the
Multithreading documentation.
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.
The time taken to set up the reference vector, if used, increases with the length of array
r. However, if the reference vector is used, the time taken to generate numbers decreases as the space allotted to the index part of
r increases. Nevertheless, there is a point, depending on the distribution, where this improvement becomes very small and the suggested value for the length of array
r is designed to approximate this point.
If
p is very small then the storage requirements for the reference vector and the time taken to set up the reference vector becomes prohibitive. In this case it is recommended that the reference vector is not used. This is achieved by selecting
.
This example prints
pseudorandom integers from a geometric distribution with parameter
, generated by a single call to
g05tcc, after initialization by
g05kfc.
None.