iarray.random.bernoulli(shape: Sequence, p: float, cfg: Optional[Config] = None, **kwargs) IArray#

Draw samples from a Bernoulli distribution.

The Bernoulli distribution is a special case of the binomial distribution where a single trial is conducted (so n would be 1 for such a binomial distribution).

The cfg and kwargs parameters are the same than in random_sample().

  • shape (Sequence) – The shape of the array to be created.

  • p (float) – Parameter of the distribution, >= 0 and <=1.


The new array.

Return type

IArray container