Files
2025-10-25 03:02:53 +03:00

3.8 KiB

[rand.req.adapt]

29 Numerics library [numerics]

29.5 Random number generation [rand]

29.5.3 Requirements [rand.req]

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

1

#

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.

2

#

The requirements of a random number engine type shall be interpreted as follows with respect to a random number engine adaptor type.

🔗

A::A();

3

#

Effects: The base engine is initialized as if by its default constructor.

🔗

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

4

#

Returns: true if a1's base engine is equal to a2's base engine.

Otherwise returns false.

🔗

A::A(result_type s);

5

#

Effects: The base engine is initialized with s.

🔗

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

6

#

Effects: The base engine is initialized with q.

🔗

void seed();

7

#

Effects: With b as the base engine, invokes b.seed().

🔗

void seed(result_type s);

8

#

Effects: With b as the base engine, invokes b.seed(s).

🔗

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

9

#

Effects: With b as the base engine, invokes b.seed(q).

10

#

A shall also meet the following additional requirements:

  • (10.1)

    The complexity of each function shall not exceed the complexity of the corresponding function applied to the base engine.

  • (10.2)

    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.

  • (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.4)

    The textual representation of A shall include the textual representation of its base engine.