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
x
of an independent_bits_engine
engine adaptor object x
consists of
the state e of its base engine e;
the size of the state is
the size of e's state.

The transition and generation algorithms
are described in terms
of the following integral constants:

The transition algorithm
is carried out
by invoking e()
as often as needed
to obtain
values less than
and
values less than .

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 += 1) { do u = e() - e.min(); while (); S = ; } for (k = ; ; k += 1) { do u = e() - e.min(); while (); S = ; }

template<class Engine, size_t w, class UIntType> class independent_bits_engine { public: // types using result_type = UIntType; // engine characteristics static constexpr result_type min() { return 0; } static constexpr result_type max() { return ; } // constructors and seeding functions independent_bits_engine(); explicit independent_bits_engine(const Engine& e); explicit independent_bits_engine(Engine&& e); explicit independent_bits_engine(result_type s); template<class Sseq> explicit independent_bits_engine(Sseq& q); void seed(); void seed(result_type s); template<class Sseq> void seed(Sseq& q); // generating functions result_type operator()(); void discard(unsigned long long z); // property functions const Engine& base() const noexcept { return e; }; private: Engine e; // exposition only };