Click or drag to resize
RandomNextGeometric Method
Generate a pseudorandom number from a geometric distribution.

Namespace: Imsl.Stat
Assembly: ImslCS (in ImslCS.dll) Version: 6.5.2.0
Syntax
public virtual int NextGeometric(
	double p
)

Parameters

p
Type: SystemDouble
A double which specifies the probability of success on each trial, 0 \lt p \le 1.

Return Value

Type: Int32
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

f(x) = P(1 - P)^{x - 1}

for x = 1, 2, \ldots and 0 \lt P \lt 1

.

The geometric distribution as defined above has mean 1/P.

The i-th geometric deviate is generated as the smallest integer not less than log(U_i)/log(1 - P ), where the U_i 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.

See Also