Namespaces
Variants

std::negative_binomial_distribution<IntType>:: negative_binomial_distribution

From cppreference.net
negative_binomial_distribution ( ) : negative_binomial_distribution ( 1 ) { }
(1) (自 C++11 起)
explicit negative_binomial_distribution ( IntType k, double p = 0.5 ) ;
(2) (自 C++11 起)
explicit negative_binomial_distribution ( const param_type & params ) ;
(3) (自 C++11 起)

构造一个新的分布对象。

2) 使用 k p 作为分布参数。
3) 使用 params 作为分布参数。

参数

k - k 分布参数(试验成功次数)
p - p 分布参数(单次试验生成 true 的概率)
params - 分布参数集合

注释

要求满足 0 < p ≤ 1 0 < k

如果 p == 1 ,后续调用不接受 param_type 对象的 operator() 重载将导致未定义行为。

默认构造的 std::negative_binomial_distribution 等同于默认构造的 std::geometric_distribution

缺陷报告

以下行为变更缺陷报告被追溯应用于先前发布的C++标准。

缺陷报告 适用范围 发布时的行为 正确行为
P0935R0 C++11 默认构造函数为显式 改为隐式