Udostępnij za pośrednictwem


discrete_distribution Class

Generuje dystrybucji dyskretna całkowitą.

template<class IntType = int>
    class discrete_distribution {
public:
    typedef IntType result_type;
    struct param_type;
    discrete_distribution();
    explicit discrete_distribution(const param_type& par0);
    template<class Fn>
        discrete_distribution(size_t count,
            double low, double high, Fn func);
    explicit discrete_distribution(const param_type& par0);
    std::vector<double> probabilities() 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:
    std::vector<double> stored_p;
    };

Parametry

Parametr

Opis

IntType

Typ wyniku całkowitą.

Uwagi

Zawiera opis tego szablonu klasy <random> daje wartości określone przez użytkownika typu integralną rozdzielonych histogram szerokość jednolite prawdopodobieństw.

Trzy wypłaty są bardzo podobne:

  • A discrete_distribution ma szerokość jednolite interwały z prawdopodobieństwem jednolitego w każdym przedziale.

  • A piecewise_constant_distribution Class ma interwały różnej szerokości z prawdopodobieństwem jednolite w każdym przedziale.

  • A piecewise_linear_distribution Class ma interwały różnej szerokości z prawdopodobieństwem liniowo różnym w każdym przedziale.

Wymagania

Nagłówek: <random>

Obszar nazw: std

Zobacz też

Informacje

<random>

discrete_distribution::discrete_distribution

discrete_distribution::operator()

discrete_distribution::param

discrete_distribution::param_type

discrete_distribution::probabilities