29.6 Random number generation [rand]
A
random number engine adaptor
(commonly shortened to
adaptor)
a of type
A
is a random number engine
that takes values
produced by some other random number engine,
and applies an algorithm to those values
in order to deliver a sequence of values
with different randomness properties
. An engine
b of type
B adapted in this way
is termed a
base engine
in this context
. The expression
a.base() shall be valid and shall return a
const reference to
a's base engine
.The requirements of a random number engine type
shall be interpreted as follows
with respect to a random number engine adaptor type
.A::A();
Effects:
The base engine is initialized
as if by its default constructor
. bool operator==(const A& a1, const A& a2);
Returns:
true if
a1's base engine is equal to
a2's base engine
. A::A(result_type s);
Effects:
The base engine is initialized
with
s. template<class Sseq> A::A(Sseq& q);
Effects:
The base engine is initialized
with
q. void seed();
Effects:
With
b as the base engine, invokes
b.seed(). void seed(result_type s);
Effects:
With
b as the base engine, invokes
b.seed(s). template<class Sseq> void seed(Sseq& q);
Effects:
With
b as the base engine, invokes
b.seed(q). A shall also satisfy
the following additional requirements:
- a)
The complexity
of each function
shall not exceed the complexity
of the corresponding function
applied to the base engine
. - b)
The state
of
A
shall include the state
of its base engine
. The size of
A's state
shall be no less than the size of the base engine
. - c)
Copying
A's state
(e.g., during copy construction or copy assignment)
shall include copying
the state of the base engine of
A. - d)
The textual representation
of
A
shall include
the textual representation of its base engine
.