共用方式為


piecewise_constant_distribution::piecewise_constant_distribution

建構散發。

piecewise_constant_distribution();
template<class InIt1, class InIt2>
    piecewise_constant_distribution(InIt1 first1, InIt1 last1,
        InIt2 first2);
template<class Fn>
    piecewise_constant_distribution(size_t count,
        double low, double high, Fn func);
explicit piecewise_constant_distribution(const param_type& par0);

參數

  • first1
    處理輸入的 Iterator 的第一個項目位置在發出範圍。

  • last1
    處理輸入的 Iterator 最後一個項目的位置會發出範圍。

  • first2
    處理輸入的 Iterator 的第一個項目位置在新版本範圍。

  • count
    項目數目發出範圍的。

  • low
    在發行範圍的最小值。

  • high
    在發行範圍的最大值。

  • func
    表示發出之物件上的函式。

  • par0
    用於參數封裝建構散發。

備註

前置條件:在 stored_p 儲存所有項目為負值,且至少有一個不是零。

第一個建構函式建構儲存值 stored_x 保留值 RealType(0.0) 和 RealType(1.0),,並儲存值 stored_p 保留值 1.0的物件。

第二個建構函式建構儲存值 stored_x 初始化這個序列 [first1, last1)的物件。 如果序列中有兩個以下的項目, stored_x 有兩個項目 RealType(0.0) 和 RealType(1.0),因此, stored_p 具有值1.的項目。 否則, stored_p 初始化開始 first2的 stored_x.size() - 1 項目關聯的註解,則會正規化,讓所有項目的總和為1。

第三個建構函式建構儲存值 stored_p 初始化 count 項目的物件。 在項目 I 除以每個範圍 high - low 成員 count subranges,然後儲存 x 的值 func(x) 在子範圍 I之中。 在 stored_x 儲存這些 subranges count + 1 端點。 如果 count < 1, stored_p 具有值 1. 的項目。

第四個建構函式會將參數從 par0初始化的物件。

需求

標題: <random>

命名空間: std

請參閱

參考

<random>

piecewise_constant_distribution Class