次の方法で共有


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

解説

このクラスは、コンストラクターの引数によって指定された確率で true を返す、bool 型の値を生成する分布を表します。

必要条件

ヘッダー : <random>

名前空間: std

参照

関連項目

<random>

bernoulli_distribution::bernoulli_distribution

bernoulli_distribution::operator()

bernoulli_distribution::p

bernoulli_distribution::param

bernoulli_distribution::param_type