Namespace:
Imsl.Stat
Assembly:
ImslCS (in ImslCS.dll) Version: 6.5.0.0
Syntax
C# |
---|
public virtual int NextGeometric( double p ) |
Visual Basic (Declaration) |
---|
Public Overridable Function NextGeometric ( _ p As Double _ ) As Integer |
Visual C++ |
---|
public: virtual int NextGeometric( double p ) |
Parameters
- p
- Type: System..::.Double
A double which specifies the probability of success on each trial,.
Return Value
A int which specifies a pseudorandom number from a geometric distribution.
Remarks
NextGeometric generates pseudorandom numbers from a geometric distribution with parameter p, where P =p is the probability of getting a success on any trial. A geometric deviate can be interpreted as the number of trials until the first success (including the trial in which the first success is obtained). The probability function is

for and
The geometric distribution as defined above has mean 1/P.
The i-th geometric deviate is generated as the smallest
integer not less than ,
where the
are independent uniform (0, 1)
random numbers (see Knuth, 1981).
The geometric distribution is often defined on 0, 1, 2, ..., with mean (1 - P)/P. Such deviates can be obtained by subtracting 1 from each element returned value.