random variable X
can be represented the number of 0
's which occur before a 1
occurs when sampling independent Bernoulli random variables for which probability of assuming a 1
and the probability of assuming a 0
then takes on the values k = 0, 1, ...
with the point probability distribution
|f(k) = |
|p (1 - p) k|| for k = 0,...|
- int Geometric_Random_Variate( double p )
This function returns X where X is the Geometric(p) random variate described above.
source code is available for this routine: