C++ 概念: RandomNumberDistribution
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
一个
i).
RandomNumberDistribution是一个函数对象,根据返回的随机数概率密度函数p(x)或离散概率分布P(xi).
Original:
A
i).
RandomNumberDistribution is a function object returning random numbers according to a 概率密度函数 p(x) or a 离散概率分布 P(xi).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 要求
| 本节是不完整的 |
-
D是一个类的RandomNumberDistribution要求。它也应满足CopyConstructible和CopyAssignable要求.Original:Dis a class meeting theRandomNumberDistributionrequirements. It shall also satisfy theCopyConstructibleandCopyAssignablerequirements.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
T是关联result_type.Original:Tis the associatedresult_type.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
P是相关联的param_type。它应满足CopyConstructible,CopyAssignable,EqualityComparable要求.Original:Pis the associatedparam_type. It shall satisfy theCopyConstructible,CopyAssignable, andEqualityComparablerequirements.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
d一个目的是D和x,y潜在const对象D.Original:dis an object ofDandx,yare potentially const objects ofD.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
p可能是一个恒定值,P.Original:pis a possibly constant value ofP.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
g,g1,g2是左值的UniformRandomNumberGenerator概念.Original:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
os是一个左值的std::basic_ostream的Original:osis an lvalue of std::basic_ostream.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
is是一个左值的std::basic_istream的Original:isis an lvalue of std::basic_istream.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
| 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. |