[rand.req.adapt]

# 29 Numerics library [[numerics]](./#numerics)

## 29.5 Random number generation [[rand]](rand#req.adapt)

### 29.5.3 Requirements [[rand.req]](rand.req#adapt)

#### 29.5.3.5 Random number engine adaptor requirements [rand.req.adapt]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2130)

A [*random number engine adaptor*](#def:random_number_engine_adaptor) (commonly shortened to [*adaptor*](#def: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[.](#1.sentence-1)

An engine b of type B adapted in this way
is termed a [*base engine*](#def:base_engine) in this context[.](#1.sentence-2)

The expression a.base() shall be valid and shall return a
const reference to a's base engine[.](#1.sentence-3)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2146)

The requirements of a random number engine type
shall be interpreted as follows
with respect to a random number engine adaptor type[.](#2.sentence-1)

[ð](#itemdecl:1)

`A::A();
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2156)

*Effects*: The base engine is initialized
 as if by its default constructor[.](#3.sentence-1)

[ð](#itemdecl:2)

`bool operator==(const A& a1, const A& a2);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2167)

*Returns*: true if a1's base engine is equal to a2's base engine[.](#4.sentence-1)

Otherwise returns false[.](#4.sentence-2)

[ð](#itemdecl:3)

`A::A(result_type s);
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2178)

*Effects*: The base engine is initialized
 with s[.](#5.sentence-1)

[ð](#itemdecl:4)

`template<class Sseq> A::A(Sseq& q);
`

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2189)

*Effects*: The base engine is initialized
 with q[.](#6.sentence-1)

[ð](#itemdecl:5)

`void seed();
`

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2200)

*Effects*: With b as the base engine, invokes b.seed()[.](#7.sentence-1)

[ð](#itemdecl:6)

`void seed(result_type s);
`

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2210)

*Effects*: With b as the base engine, invokes b.seed(s)[.](#8.sentence-1)

[ð](#itemdecl:7)

`template<class Sseq> void seed(Sseq& q);
`

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2220)

*Effects*: With b as the base engine, invokes b.seed(q)[.](#9.sentence-1)

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L2225)

A shall also meet
the following additional requirements:

- [(10.1)](#10.1)

  The complexity
 of each function
 shall not exceed the complexity
 of the corresponding function
 applied to the base engine[.](#10.1.sentence-1)

- [(10.2)](#10.2)

  The state
 of A shall include the state
 of its base engine[.](#10.2.sentence-1)
  The size of A's state
 shall be no less than the size of the base engine[.](#10.2.sentence-2)

- [(10.3)](#10.3)

  Copying A's state
 (e.g., during copy construction or copy assignment)
 shall include copying
 the state of the base engine of A[.](#10.3.sentence-1)

- [(10.4)](#10.4)

  The textual representation
 of A shall include
 the textual representation of its base engine[.](#10.4.sentence-1)
