bernoulli_distribution Class

Generates a Bernoulli distribution.

class bernoulli_distribution {
public:
    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);
private:
    const double stored_p;  // exposition only
    };

Remarks

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

Requirements

Header: <random>

Namespace: std

See Also

Reference

<random>

bernoulli_distribution::bernoulli_distribution

bernoulli_distribution::operator()

bernoulli_distribution::p

bernoulli_distribution::param

bernoulli_distribution::param_type

Other Resources

<random> Members