C++ 概念: RandomNumberDistribution

来自cppreference.com
< cpp‎ | concept

一个RandomNumberDistribution是一个函数对象,根据返回的随机数概率密度函数p(x)离散概率分布P(x
i
)
.
原文:
A RandomNumberDistribution is a function object returning random numbers according to a 概率密度函数 p(x) or a 离散概率分布 P(x
i
)
.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里

[编辑] 要求

  • D是一个类的RandomNumberDistribution要求。它也应满足CopyConstructibleCopyAssignable要求.
    原文:
    D is a class meeting the RandomNumberDistribution requirements. It shall also satisfy the CopyConstructible and CopyAssignable requirements.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • T是关联result_type.
    原文:
    T is the associated result_type.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • P是相关联的param_type。它应满足CopyConstructibleCopyAssignableEqualityComparable要求.
    原文:
    P is the associated param_type. It shall satisfy the CopyConstructible, CopyAssignable, and EqualityComparable requirements.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • d一个目的是Dxy潜在const对象D.
    原文:
    d is an object of D and x,y are potentially const objects of D.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • p可能是一个恒定值,P.
    原文:
    p is a possibly constant value of P.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • gg1g2是左值的UniformRandomNumberGenerator概念.
    原文:
    g,g1,g2 are lvalues meeting the UniformRandomNumberGenerator concept.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • os是一个左值的std::basic_ostream
    原文:
    os is an lvalue of std::basic_ostream.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • is是一个左值的std::basic_istream
    原文:
    is is an lvalue of std::basic_istream.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
Expression Type Notes Complexity
D::result_type T An arithmetic type compile-time
D::param_type P compile-time
D() constant
D(p) Same as p's construction
d.reset() void Resets the internal state of the distribution object. After a call to this function, the next call to operator() on the distribution object will not be dependent on previous calls to operator(). constant
x.param() P No worse than D(p)
d.param(p) void No worse than D(p)
d(g) T d(g, d.param()) Same as d(g, d.param())
d(g,p) T When called with the same g and p parameter it returns a sequence of numbers distributed according to p(x;p) or P(x
i
;p)
Amortized constant number of incovations of g
x.min() T The greatest lower bound returned by operator() constant
x.max() T The least upper bound returned by operator() constant
x == y bool constant
y != y bool !(x == y) constant
os << x Reference to the type of os Writes a textual representation of the distribution parameters and internal state to os as textual representation. The formatting flags and fill character of os are unchanged.
is >> d Reference to the type of is Restores the distribution parameters and internal state with data read from is. The formatting flags of is are unchanged. The data must have been written using a stream with the same locale, CharT and Traits template parameters, otherwise the behavior is undefined. If bad input is encountered, is.setstate(std::ios::failbit) is called, which may throw std::ios_base::failure. d is unchanged in that case.