std::binomial_distribution::param
param_type param() const; | (1) | (since C++11) |
---|---|---|
void param( const param_type& params ); | (2) | (since C++11) |
管理关联的分发参数集。
1%29返回相关的参数集。
2%29将相关参数设置为params
...
参数
params | - | new contents of the associated parameter set |
---|
返回值
1%29相关联的参数集。
2%29%28%29。
复杂性
常量。
例
二次
#include <iostream>
#include <random>
int main()
{
std::random_device rd;
std::mt19937 gen(rd());
using BinomialDist = std::binomial_distribution<>;
BinomialDist bino_dis(1, 0.5);
std::cout << "A sample of Binomial( 1, 0.5): " << bino_dis(gen) << '\n';
// Use another parameter set
bino_dis.param(BinomialDist::param_type(100,0.9));
std::cout << "A sample of Binomial(100, 0.9): " << bino_dis(gen) << '\n';
}
二次
可能的产出:
二次
A sample of Binomial( 1, 0.5): 0
A sample of Binomial(100, 0.9): 94
二次
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com