共用方式為


bernoulli_distribution Class

產生一個伯努利散發。

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
    };

備註

描述類別產生型別 bool值的發行版本中,傳回具有建構函式提供的可能性的 true 傳遞至建構函式。

需求

標題: <random>

命名空間: std

請參閱

參考

<random>

bernoulli_distribution::bernoulli_distribution

bernoulli_distribution::operator()

bernoulli_distribution::p

bernoulli_distribution::param

bernoulli_distribution::param_type