首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::discrete_distribution::discrete_distribution

discrete_distribution();

(1)

(since C++11)

template< class InputIt > discrete_distribution( InputIt first, InputIt last );

(2)

(since C++11)

discrete_distribution( std::initializer_list<double> weights );

(3)

(since C++11)

template< class UnaryOperation > discrete_distribution( std::size_t count, double xmin, double xmax, UnaryOperation unary_op );

(4)

(since C++11)

explicit discrete_distribution( const param_type& params );

(5)

(since C++11)

构造一个新的分发对象。

1%29默认构造函数。构造单权值p={1}的分布。此分发将始终生成?0?...

2%29构造在范围内的权重分布。[first, last).如果first == last,其效果与默认构造函数相同。

3%29构造具有权重的weights.有效地打电话discrete_distribution(weights.begin(), weights.end()).4%29构造发行版count使用函数生成的权重unary_op.每个重量等于w。

I=一元[医]OP%28 xmin+δ/2+I·δ%29,其中δ=

%28 xmax-xmin%29

*。

数数

i∈{0,...,计数-1}。xminxmax必须是δ>0。如果count == 0其效果与默认构造函数相同。

5%29构造发行版params作为分布参数。

参数

first, last

-

the range of elements defining the numbers to use as weights. The type of the elements referred by InputIterator must be convertible to double

weights

-

initializer list containing the weights

unary_op

-

unary operation function object that will be applied. The signature of the function should be equivalent to the following: Ret fun(const Type &a); The signature does not need to have const &. The type Type must be such that an object of type double can be dereferenced and then implicitly converted to Type. The type Ret must be such that an object of type double can be dereferenced and assigned a value of type Ret. ?

params

-

the distribution parameter set

类型要求

-输入必须符合输入器的要求。

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com