28 Numerics library [numerics]

28.5 Random number generation [rand]

28.5.1 General [rand.general]

Subclause [rand] defines a facility for generating (pseudo-)random numbers.
In addition to a few utilities, four categories of entities are described: uniform random bit generators, random number engines, random number engine adaptors, and random number distributions.
These categorizations are applicable to types that meet the corresponding requirements, to objects instantiated from such types, and to templates producing such types when instantiated.
[Note 1: 
These entities are specified in such a way as to permit the binding of any uniform random bit generator object e as the argument to any random number distribution object d, thus producing a zero-argument function object such as given by bind(d,e).
— end note]
Each of the entities specified in [rand] has an associated arithmetic type ([basic.fundamental]) identified as result_type.
With T as the result_type thus associated with such an entity, that entity is characterized:
If integer-valued, an entity may optionally be further characterized as signed or unsigned, according to numeric_limits<T>​::​is_signed.
Unless otherwise specified, all descriptions of calculations in [rand] use mathematical real numbers.
Throughout [rand], the operators bitand, bitor, and xor denote the respective conventional bitwise operations.
Further:
  • the operator rshift denotes a bitwise right shift with zero-valued bits appearing in the high bits of the result, and
  • the operator denotes a bitwise left shift with zero-valued bits appearing in the low bits of the result, and whose result is always taken modulo .