C++ 概念: RandomNumberDistribution
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
一个
i).
RandomNumberDistribution
是一个函数对象,根据返回的随机数概率密度函数p(x)或离散概率分布P(xi).
[编辑] 要求
本章尚未完成 |
-
D
是一个类的RandomNumberDistribution
要求。它也应满足CopyConstructible
和CopyAssignable
要求.原文:D
is a class meeting theRandomNumberDistribution
requirements. It shall also satisfy theCopyConstructible
andCopyAssignable
requirements. -
T
是关联result_type
. -
P
是相关联的param_type
。它应满足CopyConstructible
,CopyAssignable
,EqualityComparable
要求.原文:P
is the associatedparam_type
. It shall satisfy theCopyConstructible
,CopyAssignable
, andEqualityComparable
requirements. -
d
一个目的是D
和x
,y
潜在const对象D
.原文:d
is an object ofD
andx
,y
are potentially const objects ofD
. -
p
可能是一个恒定值,P
. -
os
是一个左值的std::basic_ostream的原文:os
is an lvalue of std::basic_ostream. -
is
是一个左值的std::basic_istream的原文:is
is an lvalue of std::basic_istream.
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(xi; 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. |