rBinomial

rBinomial(*args)

Realization of a binomial distribution.

Parameters:
nint, n>0

The number of trials

pfloat, 0\leq p\leq 1

The success probability of each trial

sizeint

The number of realizations to generate.

Returns:
realizationsint or Indices

The realizations of the discrete disctribution.

Notes

This method implements the rejection algorithm described in [hormann1993].

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> r = ot.DistFunc.rBinomial(5, 0.3)
>>> r = ot.DistFunc.rBinomial(5, 0.3, 10)