piecewise_linear_distribution::piecewise_linear_distribution

构造分布。

 // default constructor piecewise_linear_distribution();  // constructs using a range of intervals, [firstI, lastI), with // matching weights starting at firstW template<class InputIteratorI, class InputIteratorW> piecewise_linear_distribution(InputIteratorI firstI, InputIteratorI lastI, InputIteratorW firstW);  // constructs using an initializer list for range of intervals, // with weights generated by function weightfunc template<class UnaryOperation> piecewise_linear_distribution(initializer_list<RealType> intervals, UnaryOperation weightfunc);  // constructs using an initializer list for range of count intervals, // distributed uniformly over [xmin,xmax] with weights generated by function weightfunc template<class UnaryOperation> piecewise_linear_distribution(size_t count, RealType xmin, RealType xmax, UnaryOperation weightfunc);  // constructs from an existing param_type structure explicit piecewise_linear_distribution(const param_type& parm); 

参数

  • firstI
    分布范围中第一个元素的输入迭代器。

  • lastI
    分布范围中最后一个元素的输入迭代器。

  • firstW
    权重范围中第一个元素的输入迭代器。

  • intervals
    具有分布区间的 initializer_list

  • count
    分布范围中的元素数。

  • xmin
    分布范围中的最低值。

  • xmax
    分布范围中的最高值。 必须大于 xmin。

  • weightfunc
    表示分布的概率函数的对象。 参数和返回值都必须可转换为 double。

  • parm
    用于构造分布的参数结构。

备注

默认构造函数将设置存储参数,以便存在一个概率密度为 1 的 0 到 1 的区间。

迭代器范围构造函数

template<class InputIteratorI, class InputIteratorW>
piecewise_linear_distribution(InputIteratorI firstI, InputIteratorI lastI,
        InputIteratorW firstW);

使用序列 [firstI,lastI) 上迭代器中的区间和以 firstW 开始的匹配权重序列来构造分布对象。

初始值设定项列表构造函数

template<class UnaryOperation>
piecewise_linear_distribution(initializer_list<RealType> intervals, 
        UnaryOperation weightfunc);

使用初始值设定项列表 intervals 中的区间和从函数 weightfunc 中生成的权重来构造分布对象。

定义为以下内容的构造函数

template<class UnaryOperation>
piecewise_linear_distribution(size_t count, RealType xmin, RealType xmax,
        UnaryOperation weightfunc);

使用在 [xmin,xmax] 上均匀分布的 count 个区间来构造分布对象,从而根据函数 weightfunc 分配每个区间权重,weightfunc 必须接受一个参数并包含一个返回值,两者都可转换为 double。 **前置条件:**xmin < xmax。

定义为以下内容的构造函数

explicit piecewise_linear_distribution(const param_type& parm);

通过将 parm 用作存储的参数结构,构造分布对象。

要求

标头:<random>

命名空间: std

请参见

参考

<random>

piecewise_linear_distribution 类