Geometric distribution (source code)

= Geometric distribution
{wiki}

= Geometric random variable
{synonym}

A geometric distribution models the number of independent Bernoulli trials needed to obtain the first success. On the convention supported by $1,2,\ldots$, its mass is $(1-p)^{k-1}p$ and its mean is $1/p$. On the failures-before-first-success convention supported by $0,1,\ldots$, its mass is $(1-p)^kp$ and its mean is $(1-p)/p$. Both conventions have variance $(1-p)/p^2$.