26 Numerics library [numerics]

26.5 Random number generation [rand]

26.5.1 Requirements [rand.req]

26.5.1.3 Uniform random number generator requirements [rand.req.urng]

A uniform random number generator g of type G is a function object returning unsigned integer values such that each value in the range of possible results has (ideally) equal probability of being returned. [ Note: The degree to which g's results approximate the ideal is often determined statistically.  — end note ]

A class G satisfies the requirements of a uniform random number generator if the expressions shown in Table [tab:UniformRandomNumberGenerator] are valid and have the indicated semantics, and if G also satisfies all other requirements of this section [rand.req.urng]. In that Table and throughout this section:

  1. T is the type named by G's associated result_type, and

  2. g is a value of G.

Table 116 — Uniform random number generator requirements
ExpressionReturn typePre/post-conditionComplexity
G::result_type T T is an unsigned integer type ([basic.fundamental]). compile-time
g() T Returns a value in the closed interval [G::min(), G::max()]. amortized constant
G::min() T Denotes the least value potentially returned by operator(). compile-time
G::max() T Denotes the greatest value potentially returned by operator(). compile-time

The following relation shall hold: G::min() < G::max().