g05th generates a vector of pseudorandom integers from the discrete negative binomial distribution with parameter and probability of success at a trial.
public static void g05th( mode, n, m, p,  r, G05..::.G05State g05state,  x, out ifail )
|Visual Basic (Declaration)|
Public Shared Sub g05th ( _ mode As , _ n As , _ m As , _ p As , _ r As (), _ g05state As G05..::.G05State, _ x As (), _ < > ByRef ifail As _ )
public: static void g05th( mode, n, m, p, array< >^ r, G05..::.G05State^ g05state, array< >^ x, [ ] % ifail )
static member g05th : mode: * n: * m: * 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 g05th.
- 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 number of failures of the distribution.Constraint: .
On entry: , the parameter of the negative binomial distribution representing the probability of success at a single trial.Constraint: .
- Type: array<
>()An array of size [lr]Note: lr must satisfy the constraint:
On entry: if , the reference vector from the previous call to g05th.On exit: the reference vector.
- if or ,
- if , lr must remain unchanged from the previous call to g05th.
- if or ,
- Type: array<
>()An array of size [n]On exit: the pseudorandom numbers from the specified negative binomial distribution.
On exit: unless the method detects an error (see [Error Indicators and Warnings]).
g05th generates integers from a discrete negative binomial distribution, where the probability of ( successes before failures) 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 g05th with the same parameter value can then use this reference vector to generate further variates.
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.
This example prints pseudorandom integers from a negative binomial distribution with parameters and , generated by a single call to g05th, after initialization by the state constructor (for a repeatable sequence).