discrete_distribution Class
產生分隔整數散發。
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;
};
參數
參數 |
描述 |
---|---|
IntType |
整數結果型別。 |
備註
會根據可能性統一寬度長條圖散發的使用者指定的整數類資料型別之值的這個範本類別描述 <random> 。
三個版本非常類似:
discrete_distribution 具有一致的可能性的統一寬度間隔在每個間隔。
piecewise_constant_distribution Class 具有一致的可能性的變更寬度間隔在每個間隔。
piecewise_linear_distribution Class 會以線性方式發生的機率的變更寬度間隔在每個間隔。
需求
標題: <random>
命名空間: std
請參閱
參考
discrete_distribution::discrete_distribution
discrete_distribution::operator()