A RandomNumberDistribution is a function object returning random numbers according to a probability density function p(x) or a discrete probability distribution P(xi).
[edit] RequirementsThe type D
satisfies RandomNumberDistribution if
D
satisfies CopyConstructibleD
satisfies CopyAssignableGiven
T
, the type named by D::result_typeP
, the type named by D::param_type, whichD
that take arguments corresponding to the distribution parametersD
that returns a parameter of the distributiond
, a value of type D
x
and y
, (possibly const) values of type D
p
, a (possibly const) value of type P
g
, g1
, g2
, lvalues of a type satisfying UniformRandomBitGeneratoros
, lvalue of a specialization of std::basic_ostreamis
, lvalue of a specialization of std::basic_istreamThe following expressions must be valid and have their specified effects
Expression Type Notes ComplexityD::result_type
T
An arithmetic type Compile-time D::param_type
P
Compile-time D()
Creates a distribution indistinguishable from any other default-constructed D
Constant D(p)
Creates a distribution indistinguishable from D
constructed directly from the values used to construct p
Same as p
's construction d.reset()
void
Resets the internal state of the distribution. The next call to operator()
on d
will not depend on values produced by any engine prior to reset()
Constant x.param()
P
Returns p
such that D(p).param() == p No worse than D(p)
d.param(p)
void
Postcondition: d.param() == p No worse than D(p)
d(g)
T
The sequence of numbers returned by successive invocations of this call with the same g
are randomly distributed according to the distribution parametrized by d.param()
Amortized constant number of invocations of g
d(g,p)
T
The sequence of numbers returned by successive invocations of this call with the same g
are randomly distributed according to the distribution parametrized by p
Amortized constant number of invocations of g
x.min()
T
The greatest lower bound on the values potentially returned by x
âs operator()
, as determined by the current values of x
âs parameters Constant x.max()
T
The least upper bound on the values potentially returned by x
âs operator()
, as determined by the current values of x
âs parameters Constant x == y
bool
Establishes an equivalence relation. Returns true
if x.param() == y.param() and future infinite sequences of values that would be generated by repeated invocations of x(g1) and y(g2) would be equal as long as g1 == g2 Constant x != 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
. 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
stream 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 [edit] Notes
The parameters of a distribution object may be changed either permanently, by using d.param(p) or just for the duration of a single operator() call, by using d(g,p).
Calls to const member functions of the distribution and os << d do not affect the sequence of numbers produced by repeated d(g).
[edit] Standard libraryThe following standard library components satisfy RandomNumberDistribution
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4