We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

bernoulli_distribution Class

Generates a Bernoulli distribution.

class bernoulli_distribution {
    typedef int input_type;
    struct param_type;
    typedef bool result_type;
    explicit bernoulli_distribution(double p0 = 0.5);
    explicit bernoulli_distribution(const param_type& par0);
    double p() const;
    param_type param() const;
    void param(const param_type& par0);
    result_type min() const;
    result_type max() const;
    void reset();
    template<class Engine>
        result_type operator()(Engine& eng);
    template<class Engine>
        result_type operator()(Engine& eng,
            const param_type& par0);
    const double stored_p;  // exposition only

The class describes a distribution that produces values of type bool, returning true with a probability given by the argument to the constructor.

Header: <random>

Namespace: std