Main Content

Geometric random numbers

`r = geornd(p)`

r = geornd(p,m,n,...)

r = geornd(p,[m,n,...])

`r = geornd(p)`

generates
random numbers from a geometric distribution with probability parameter `p`

. `p`

can
be a vector, a matrix, or a multidimensional array. The size of `r`

is
equal to the size of `p`

. The parameters in `p`

must
lie in the interval `[0,1]`

.

`r = geornd(p,m,n,...)`

or `r = geornd(p,[m,n,...])`

generates a multidimensional `m`

-by-`n`

-by-`...`

array
containing random numbers from the geometric distribution with probability
parameter `p`

. `p`

can be a scalar
or an array of the same size as `r`

.

The geometric distribution is useful to model the number of
failures before one success in a series of independent trials, where
each trial results in either success or failure, and the probability
of success in any individual trial is the constant `p`

.