Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content


Constructs the distribution.

explicit bernoulli_distribution(double p = 0.5);

explicit bernoulli_distribution(const param_type& parm);


The stored p distribution parameter.


The parameter structure used to construct the distribution.

Precondition: 0.0 ≤ p ≤ 1.0

The first constructor constructs an object whose stored p value holds the value p.

The second constructor constructs an object whose stored parameters are initialized from parm. You can obtain and set the current parameters of an existing distribution by calling the param() member function.

For more information and a code example, see binomial_distribution Class.

Header: <random>

Namespace: std

© 2015 Microsoft