jax.random.geometric#
- jax.random.geometric(key, p, shape=None, dtype=<class 'int'>)[source]#
Sample Geometric random values with given shape and float dtype.
The values are returned according to the probability mass function:
\[f(k;p) = p(1-p)^{k-1}\]on the domain \(0 < p < 1\).
- Parameters
key (
Union
[Array
,PRNGKeyArray
]) – a PRNG key used as the random key.p (
Union
[Array
,ndarray
,bool_
,number
,bool
,int
,float
,complex
]) – a float or array of floats broadcast-compatible withshape
representing the the probability of success of an individual trial.shape (
Optional
[Sequence
[int
]]) – optional, a tuple of nonnegative integers specifying the result shape. Must be broadcast-compatible withp
. The default (None) produces a result shape equal tonp.shape(p)
.dtype (
Union
[Any
,str
,dtype
,SupportsDType
]) – optional, a int dtype for the returned values (default int64 if jax_enable_x64 is true, otherwise int32).
- Return type
- Returns
A random array with the specified dtype and with shape given by
shape
ifshape
is not None, or else byp.shape
.