Warning
This page was created from a pull request.
jax.random.bernoulliΒΆ
-
jax.random.
bernoulli
(key, p=0.5, shape=None)[source]ΒΆ Sample Bernoulli random values with given shape and mean.
- Parameters
key (
ndarray
) β a PRNGKey used as the random key.p (
ndarray
) β optional, a float or array of floats for the mean of the random variables. Must be broadcast-compatible withshape
. Default 0.5.shape (
Optional
[Sequence
[int
]]) β optional, a tuple of nonnegative integers representing the result shape. Must be broadcast-compatible withp.shape
. The default (None) produces a result shape equal top.shape
.
- Return type
ndarray
- Returns
A random array with boolean dtype and shape given by
shape
ifshape
is not None, or elsep.shape
.