mlx.core.random.bernoulli#
- bernoulli(p: scalar | array = 0.5, shape: Sequence[int] | None = None, key: array | None = None, stream: None | Stream | Device = None) array #
Generate Bernoulli random values.
The values are sampled from the bernoulli distribution with parameter
p
. The parameterp
can be afloat
orarray
and must be broadcastable toshape
.