g05tc generates a vector of pseudorandom integers from the discrete geometric distribution with probability of success at a trial.
public static void g05tc( mode, n, p,  r, G05..::.G05State g05state,  x, out ifail )
|Visual Basic (Declaration)|
Public Shared Sub g05tc ( _ mode As , _ n As , _ p As , _ r As (), _ g05state As G05..::.G05State, _ x As (), _ < > ByRef ifail As _ )
public: static void g05tc( mode, n, p, array< >^ r, G05..::.G05State^ g05state, array< >^ x, [ ] % ifail )
static member g05tc : mode: * n: * p: * r:  * g05state:G05..::.G05State * x:  * ifail: byref -> unit
On entry: a code for selecting the operation to be performed by the method.
Constraint: , , or .
- Set up reference vector only.
- Generate variates using reference vector set up in a prior call to g05tc.
- Set up reference vector and generate variates.
- Generate variates without using the reference vector.
On entry: , the number of pseudorandom numbers to be generated.Constraint: .
On entry: the parameter of the geometric distribution representing the probability of success at a single trial.Constraint: (see x02aj).
- Type: array<
>()An array of size [lr]Note: lr must satisfy the constraint:
On entry: if , the reference vector from the previous call to g05tc.On exit: the reference vector.
- if or , ;
- if , lr should remain unchanged from the previous call to g05tc.
- Type: array<
>()An array of size [n]On exit: the pseudorandom numbers from the specified geometric distribution.
On exit: unless the method detects an error (see [Error Indicators and Warnings]).
g05tc 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 g05tc 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.
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (lr, lstate) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, the r vector was not initialized correctly or has been corrupted.
On entry, g05state vector was not initialized or has been corrupted.
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 g05tc, after initialization by the state constructor (for a repeatable sequence).