Every function described in this subclause [rand.adapt]
that has a function parameter q of type Sseq&
for a template type parameter named Sseq
that is different from type seed_seq
throws what and when the invocation of q.generate throws.
Descriptions are provided in this subclause [rand.adapt]
only for adaptor operations
that are not described in subclause [rand.req.adapt]
or for operations where there is additional semantic information.
In particular,
declarations for copy constructors,
for copy assignment operators,
for streaming operators,
and for equality and inequality operators
are not shown in the synopses.
Each template specified in this subclause [rand.adapt]
requires one or more relationships,
involving the value(s) of its non-type template parameter(s), to hold.
A program instantiating any of these templates
is ill-formed
if any such required relationship fails to hold.
An independent_bits_engine
random number engine adaptor
combines random numbers
that are produced by some base engine e,
so as to produce random numbers
with a specified number of bits w.
The state xi
of an independent_bits_engine
engine adaptor object x
consists of
the state ei of its base engine e;
the size of the state is
the size of e's state.
The transition algorithm
is carried out by invoking e()
as often as needed to obtain n0
values less than y0+e.min()
and n−n0 values less than y1+e.min().
The generation algorithm
uses the values produced
while advancing the state as described above
to yield a quantity S
obtained as if by the following algorithm:
S=0;
for(k=0; k≠n0; k+=1){dou= e()- e.min(); while(u≥y0);
S=2w0⋅S+umod2w0;
}for(k=n0; k ≠ n; k+=1){dou= e()- e.min(); while(u≥y1);
S=2w0+1⋅S+umod2w0+1;
}
A shuffle_order_engine random number engine adaptor
produces the same random numbers
that are produced by some base engine e,
but delivers them in a different sequence.
The state xi
of a shuffle_order_engine engine adaptor object x
consists of
the state ei of its base engine e,
an additional value Y of the type delivered by e,
and
an additional sequence V of k values
also of the type delivered by e.
The size of the state is
the size of e's state plus k+1.
In addition to its behavior
pursuant to subclause [rand.req.adapt],
each constructor
that is not a copy constructor
initializes V[0], …, V[k-1] and Y,
in that order,
with values returned by successive invocations of e().