Каждый тип, созданный из шаблона класса, указанного в этом разделе, [rand.dist] удовлетворяет требованиям random number distribution типа.
Описания представлены в этом разделе [rand.dist] только для операций распространения, которые не описаны, [rand.req.dist] или для операций, для которых имеется дополнительная семантическая информация. В частности, объявления для конструкторов копирования, для операторов присваивания копий, для операторов потоковой передачи и для операторов равенства и неравенства не показаны в резюме.
uniform_int_distribution Случайное распределение числа производит случайные целые числа i, a≤i≤b, распределенные в соответствии с постоянной дискретной функцией вероятности
P(i|a,b)=1/(b−a+1).
template<class IntType = int> class uniform_int_distribution { public: // types using result_type = IntType; using param_type = unspecified; // constructors and reset functions explicit uniform_int_distribution(IntType a = 0, IntType b = numeric_limits<IntType>::max()); explicit uniform_int_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions result_type a() const; result_type b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit uniform_int_distribution(IntType a = 0, IntType b = numeric_limits<IntType>::max());
Effects: Строит uniform_int_distribution объект; a и b соответствуют соответствующим параметрам распределения.
result_type a() const;
result_type b() const;
uniform_real_distribution Случайное распределение числа производит случайные числа x, a≤x<b, распределенные в соответствии с функцией плотности вероятности постоянной
p(x|a,b)=1/(b−a).
[ Note: Это означает, что p(x|a,b) не определено, когда a == b. ] — end note
template<class RealType = double> class uniform_real_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructors and reset functions explicit uniform_real_distribution(RealType a = 0.0, RealType b = 1.0); explicit uniform_real_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions result_type a() const; result_type b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit uniform_real_distribution(RealType a = 0.0, RealType b = 1.0);
Effects: Строит uniform_real_distribution объект; a и b соответствуют соответствующим параметрам распределения.
result_type a() const;
result_type b() const;
bernoulli_distribution Распределение случайных чисел производит bool значения , b распределенных в соответствии с дискретной вероятностной функцией
P(b|p)={pifb=true1−pifb=false.
class bernoulli_distribution { public: // types using result_type = bool; using param_type = unspecified; // constructors and reset functions explicit bernoulli_distribution(double p = 0.5); explicit bernoulli_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions double p() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit bernoulli_distribution(double p = 0.5);
double p() const;
binomial_distribution Случайное распределение числа производит целые значения i≥0 распределены по дискретной функции вероятности
P(i|t,p)=(ti)⋅pi⋅(1−p)t−i.
template<class IntType = int> class binomial_distribution { public: // types using result_type = IntType; using param_type = unspecified; // constructors and reset functions explicit binomial_distribution(IntType t = 1, double p = 0.5); explicit binomial_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions IntType t() const; double p() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit binomial_distribution(IntType t = 1, double p = 0.5);
Effects: Строит binomial_distribution объект; t и p соответствуют соответствующим параметрам распределения.
IntType t() const;
double p() const;
geometric_distribution Случайное распределение числа производит целые значения i≥0 распределены по дискретной функции вероятности
P(i|p)=p⋅(1−p)i.
template<class IntType = int> class geometric_distribution { public: // types using result_type = IntType; using param_type = unspecified; // constructors and reset functions explicit geometric_distribution(double p = 0.5); explicit geometric_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions double p() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit geometric_distribution(double p = 0.5);
double p() const;
negative_binomial_distribution Случайное распределение числа производит случайные целые числа , i≥0 распределенные в соответствии с дискретной вероятностной функцией
P(i|k,p)=(k+i−1i)⋅pk⋅(1−p)i.
[ Note: Это означает, что P(i|k,p) не определено, когда p == 1. ] — end note
template<class IntType = int> class negative_binomial_distribution { public: // types using result_type = IntType; using param_type = unspecified; // constructor and reset functions explicit negative_binomial_distribution(IntType k = 1, double p = 0.5); explicit negative_binomial_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions IntType k() const; double p() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit negative_binomial_distribution(IntType k = 1, double p = 0.5);
Effects: Строит negative_binomial_distribution объект; k и p соответствуют соответствующим параметрам распределения.
IntType k() const;
double p() const;
poisson_distribution Случайное распределение числа производит целые значения i≥0 распределены по дискретной функции вероятности
P(i|μ)=e−μμii!.
Параметр распределения μ также известен как это распределение . mean
template<class IntType = int> class poisson_distribution { public: // types using result_type = IntType; using param_type = unspecified; // constructors and reset functions explicit poisson_distribution(double mean = 1.0); explicit poisson_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions double mean() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit poisson_distribution(double mean = 1.0);
double mean() const;
exponential_distribution Случайное распределение числа производит случайные числа , x>0 распределенные в соответствии с функцией плотности вероятности
p(x|λ)=λe−λx.
template<class RealType = double> class exponential_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructors and reset functions explicit exponential_distribution(RealType lambda = 1.0); explicit exponential_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType lambda() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit exponential_distribution(RealType lambda = 1.0);
RealType lambda() const;
gamma_distribution Случайное распределение числа производит случайные числа , x>0 распределенные в соответствии с функцией плотности вероятности
p(x|α,β)=e−x/ββα⋅Γ(α)⋅xα−1.
template<class RealType = double> class gamma_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructors and reset functions explicit gamma_distribution(RealType alpha = 1.0, RealType beta = 1.0); explicit gamma_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType alpha() const; RealType beta() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit gamma_distribution(RealType alpha = 1.0, RealType beta = 1.0);
RealType alpha() const;
RealType beta() const;
weibull_distribution Случайное распределение числа производит случайные числа , x≥0 распределенные в соответствии с функцией плотности вероятности
p(x|a,b)=ab⋅(xb)a−1⋅exp(−(xb)a).
template<class RealType = double> class weibull_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions explicit weibull_distribution(RealType a = 1.0, RealType b = 1.0); explicit weibull_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType a() const; RealType b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit weibull_distribution(RealType a = 1.0, RealType b = 1.0);
Effects: Строит weibull_distribution объект; a и b соответствуют соответствующим параметрам распределения.
RealType a() const;
RealType b() const;
extreme_value_distribution Случайное распределение числа производит случайные числа , x распределенные в соответствии с функцией плотности вероятности274
p(x|a,b)=1b⋅exp(a−xb−exp(a−xb)).
template<class RealType = double> class extreme_value_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions explicit extreme_value_distribution(RealType a = 0.0, RealType b = 1.0); explicit extreme_value_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType a() const; RealType b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit extreme_value_distribution(RealType a = 0.0, RealType b = 1.0);
Effects: Создает extreme_value_distribution объект; a и b соответствуют соответствующим параметрам распределения.
RealType a() const;
RealType b() const;
Распределение, соответствующее этой функции плотности вероятности, также известно (с возможным изменением переменной) как распределение Гамбеля типа I, лог-Вейбулла или распределение Фишера-Типпетта типа I.
normal_distribution Случайное распределение числа производит случайные числа , x распределенные в соответствии с функцией плотности вероятности
p(x|μ,σ)=1σ√2π⋅exp(−(x−μ)22σ2).
Параметры распределения μ и σ также известны как этого распределения и . mean standard deviation
template<class RealType = double> class normal_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructors and reset functions explicit normal_distribution(RealType mean = 0.0, RealType stddev = 1.0); explicit normal_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType mean() const; RealType stddev() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit normal_distribution(RealType mean = 0.0, RealType stddev = 1.0);
Effects: Строит normal_distribution объект; mean и stddev соответствуют соответствующим параметрам распределения.
RealType mean() const;
RealType stddev() const;
lognormal_distribution Случайное распределение числа производит случайные числа , x>0 распределенные в соответствии с функцией плотности вероятности
p(x|m,s)=1sx√2π⋅exp(−(lnx−m)22s2).
template<class RealType = double> class lognormal_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions explicit lognormal_distribution(RealType m = 0.0, RealType s = 1.0); explicit lognormal_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType m() const; RealType s() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit lognormal_distribution(RealType m = 0.0, RealType s = 1.0);
Effects: Строит lognormal_distribution объект; m и s соответствуют соответствующим параметрам распределения.
RealType m() const;
RealType s() const;
chi_squared_distribution Случайное распределение числа производит случайные числа , x>0 распределенные в соответствии с функцией плотности вероятности
p(x|n)=x(n/2)−1⋅e−x/2Γ(n/2)⋅2n/2.
template<class RealType = double> class chi_squared_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions explicit chi_squared_distribution(RealType n = 1); explicit chi_squared_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType n() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit chi_squared_distribution(RealType n = 1);
RealType n() const;
cauchy_distribution Случайное распределение числа производит случайные числа , x распределенные в соответствии с функцией плотности вероятности
p(x|a,b)=(πb(1+(x−ab)2))−1.
template<class RealType = double> class cauchy_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions explicit cauchy_distribution(RealType a = 0.0, RealType b = 1.0); explicit cauchy_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType a() const; RealType b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit cauchy_distribution(RealType a = 0.0, RealType b = 1.0);
Effects: Строит cauchy_distribution объект; a и b соответствуют соответствующим параметрам распределения.
RealType a() const;
RealType b() const;
fisher_f_distribution Случайное распределение числа производит случайные числа , x≥0 распределенные в соответствии с функцией плотности вероятности
p(x|m,n)=Γ((m+n)/2)Γ(m/2)Γ(n/2)⋅(mn)m/2⋅x(m/2)−1⋅(1+mxn)−(m+n)/2.
template<class RealType = double> class fisher_f_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions explicit fisher_f_distribution(RealType m = 1, RealType n = 1); explicit fisher_f_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType m() const; RealType n() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit fisher_f_distribution(RealType m = 1, RealType n = 1);
Effects: Строит fisher_f_distribution объект; m и n соответствуют соответствующим параметрам распределения.
RealType m() const;
RealType n() const;
student_t_distribution Случайное распределение числа производит случайные числа , x распределенные в соответствии с функцией плотности вероятности
p(x|n)=1√nπ⋅Γ((n+1)/2)Γ(n/2)⋅(1+x2n)−(n+1)/2.
template<class RealType = double> class student_t_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions explicit student_t_distribution(RealType n = 1); explicit student_t_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions RealType n() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
explicit student_t_distribution(RealType n = 1);
RealType n() const;
discrete_distribution Случайное распределение числа производит случайные целые числа i, 0≤i<n, распределенных в соответствии с дискретной вероятностной функции
P(i|p0,…,pn−1)=pi.
Если не указано иное, параметры распределения рассчитываются как:, pk=wk/S for k=0,…,n−1 в котором значения wk, обычно известные как , должны быть неотрицательными, отличными от NaN и бесконечными. Кроме того, соотношение должно занимать: . weights 0<S=w0+⋯+wn−1
template<class IntType = int> class discrete_distribution { public: // types using result_type = IntType; using param_type = unspecified; // constructor and reset functions discrete_distribution(); template<class InputIterator> discrete_distribution(InputIterator firstW, InputIterator lastW); discrete_distribution(initializer_list<double> wl); template<class UnaryOperation> discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw); explicit discrete_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions vector<double> probabilities() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
discrete_distribution();
Effects: Создает discrete_distribution объект с помощью n=1 и p0=1. [ Note: Такой объект всегда будет иметь ценность 0. ] — end note
template<class InputIterator>
discrete_distribution(InputIterator firstW, InputIterator lastW);
Requires: InputIterator должны удовлетворять требованиям input iterator. Кроме того, iterator_traits<InputIterator>::value_type будет обозначать тип, в который можно преобразовать double. Если firstW == lastW, пусть n=1 и w0=1. В противном случае [firstW,lastW) формируется последовательность w длины n>0.
discrete_distribution(initializer_list<double> wl);
template<class UnaryOperation>
discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
Requires: Каждый экземпляр типа UnaryOperation должен быть function object типом возвращаемого значения, в который можно преобразовать double. Более того, double должен быть преобразован в тип UnaryOperationединственного параметра. Если nw=0, пусть n=1, иначе пусть n=nw. Отношение 0<δ=(xmax−xmin)/n должно сохраняться.
Effects: Создает discrete_distribution объект с вероятностями, заданными формулой выше, используя следующие значения: Если nw=0, пусть w0=1. В противном случае пусть wk=fw(xmin+k⋅δ+δ/2) для k=0,…,n−1.
vector<double> probabilities() const;
piecewise_constant_distribution Случайное распределение числа производит случайные числа x, b0≤x<bnравномерно распределяется по каждому подинтервалу в[bi,bi+1) соответствии с функцией плотности вероятности
p(x|b0,…,bn,ρ0,…,ρn−1)=ρi, for bi≤x<bi+1.
Параметры n+1 распределения bi, также известные как это распределение , должны удовлетворять соотношению для . Если не указано иное, остальные параметры распределения рассчитываются как: interval boundaries bi<bi+1 i=0,…,n−1 n
ρk=wkS⋅(bk+1−bk) for k=0,…,n−1,
в котором значения wk, обычно известные как the , должны быть неотрицательными, отличными от NaN и бесконечными. Кроме того, соотношение должно занимать: . weights 0<S=w0+⋯+wn−1
template<class RealType = double> class piecewise_constant_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions piecewise_constant_distribution(); template<class InputIteratorB, class InputIteratorW> piecewise_constant_distribution(InputIteratorB firstB, InputIteratorB lastB, InputIteratorW firstW); template<class UnaryOperation> piecewise_constant_distribution(initializer_list<RealType> bl, UnaryOperation fw); template<class UnaryOperation> piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw); explicit piecewise_constant_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions vector<result_type> intervals() const; vector<result_type> densities() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
piecewise_constant_distribution();
template<class InputIteratorB, class InputIteratorW>
piecewise_constant_distribution(InputIteratorB firstB, InputIteratorB lastB,
InputIteratorW firstW);
Requires: InputIteratorB и InputIteratorW каждый должен удовлетворять требованиям своего input iterator типа. Кроме того, каждый iterator_traits<InputIteratorB>::value_type и iterator_traits<InputIteratorW>::value_typeдолжен обозначать тип, в который можно преобразовать double. Если firstB == lastB или ++firstB == lastB, пусть n=1, w0=1, b0=0и b1=1. В противном случае [firstB,lastB) должен формировать последовательность b длины n+1, длина последовательности, w начиная с, firstW должна быть не менее n, и любое значение wk for k≥n должно игнорироваться распределением.
template<class UnaryOperation>
piecewise_constant_distribution(initializer_list<RealType> bl, UnaryOperation fw);
Requires: Каждый экземпляр типа UnaryOperation должен быть function object типом возвращаемого значения, в который можно преобразовать double. Более того, double должен быть преобразован в тип UnaryOperationединственного параметра.
Effects: Создает piecewise_constant_distribution объект с параметрами , принятых или вычисленных из следующих значений: Если bl.size()<2, пусть n=1, w0=1, b0=0и b1=1. В противном случае позвольте [bl.begin(),bl.end()) сформировать последовательность b0,…,bnи позвольте wk=fw((bk+1+bk)/2) для k=0,…,n−1.
template<class UnaryOperation>
piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
Requires: Каждый экземпляр типа UnaryOperation должен быть function object типом возвращаемого значения, в который можно преобразовать double. Более того, double должен быть преобразован в тип UnaryOperationединственного параметра. Если nw=0, пусть n=1, иначе пусть n=nw. Отношение 0<δ=(xmax−xmin)/n должно сохраняться.
Effects: Создает piecewise_constant_distribution объект с параметрами, взятыми или вычисленными из следующих значений: Let bk=xmin+k⋅δ for k=0,…,nи wk=fw(bk+δ/2) for k=0,…,n−1.
vector<result_type> intervals() const;
Returns: Объект vector<result_type> , size член которого возвращается n+1 и operator[] член которого возвращается bk при вызове с аргументом k for k=0,…,n.
vector<result_type> densities() const;
piecewise_linear_distribution Случайное распределение числа производит случайные числа x, b0≤x<bn, распределяется по каждому подинтервалу в[bi,bi+1) соответствии с функцией плотности вероятности
p(x|b0,…,bn,ρ0,…,ρn)=ρi⋅bi+1−xbi+1−bi+ρi+1⋅x−bibi+1−bi, for bi≤x<bi+1.
Параметры n+1 распределения bi, также известные как это распределение , должны удовлетворять соотношению для . Если не указано иное, остальные параметры распределения вычисляются как , в котором значения , обычно известные как , должны быть неотрицательными, отличными от NaN и бесконечными. Кроме того, должно выполняться следующее соотношение: interval boundaries bi<bi+1 i=0,…,n−1 n+1 ρk=wk/S for k=0,…,n wk weights at boundaries
0<S=12⋅n−1∑k=0(wk+wk+1)⋅(bk+1−bk).
template<class RealType = double> class piecewise_linear_distribution { public: // types using result_type = RealType; using param_type = unspecified; // constructor and reset functions piecewise_linear_distribution(); template<class InputIteratorB, class InputIteratorW> piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB, InputIteratorW firstW); template<class UnaryOperation> piecewise_linear_distribution(initializer_list<RealType> bl, UnaryOperation fw); template<class UnaryOperation> piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw); explicit piecewise_linear_distribution(const param_type& parm); void reset(); // generating functions template<class URBG> result_type operator()(URBG& g); template<class URBG> result_type operator()(URBG& g, const param_type& parm); // property functions vector<result_type> intervals() const; vector<result_type> densities() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; };
piecewise_linear_distribution();
template<class InputIteratorB, class InputIteratorW>
piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB,
InputIteratorW firstW);
Requires: InputIteratorB и InputIteratorW каждый должен удовлетворять требованиям своего input iterator типа. Кроме того, каждый iterator_traits<InputIteratorB>::value_type и iterator_traits<InputIteratorW>::value_typeдолжен обозначать тип, в который можно преобразовать double. Если firstB == lastB или ++firstB == lastB, пусть n=1, ρ0=ρ1=1, b0=0и b1=1. В противном случае [firstB,lastB) должен формировать последовательность b длины n+1, длина последовательности, w начиная с, firstW должна быть не менее n+1, и любое значение wk for k≥n+1 должно игнорироваться распределением.
template<class UnaryOperation>
piecewise_linear_distribution(initializer_list<RealType> bl, UnaryOperation fw);
Requires: Каждый экземпляр типа UnaryOperation должен быть function object типом возвращаемого значения, в который можно преобразовать double. Более того, double должен быть преобразован в тип UnaryOperationединственного параметра.
Effects: Создает piecewise_linear_distribution объект с параметрами , принятых или вычисленных из следующих значений: Если bl.size()<2, пусть n=1, ρ0=ρ1=1, b0=0и b1=1. В противном случае позвольте [bl.begin(),bl.end()) сформировать последовательность b0,…,bnи позвольте wk=fw(bk) для k=0,…,n.
template<class UnaryOperation>
piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
Requires: Каждый экземпляр типа UnaryOperation должен быть function object типом возвращаемого значения, в который можно преобразовать double. Более того, double должен быть преобразован в тип UnaryOperationединственного параметра. Если nw=0, пусть n=1, иначе пусть n=nw. Отношение 0<δ=(xmax−xmin)/n должно сохраняться.
Effects: Создает piecewise_linear_distribution объект с параметрами, взятыми или вычисленными из следующих значений: Let bk=xmin+k⋅δ for k=0,…,nи wk=fw(bk) for k=0,…,n.
vector<result_type> intervals() const;
Returns: Объект vector<result_type> , size член которого возвращается n+1 и operator[] член которого возвращается bk при вызове с аргументом k for k=0,…,n.
vector<result_type> densities() const;