2.6 KiB
[rand.req.urng]
29 Numerics library [numerics]
29.5 Random number generation [rand]
29.5.3 Requirements [rand.req]
29.5.3.3 Uniform random bit generator requirements [rand.req.urng]
A uniform random bit generatorg 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 1:
The degree to which g's results approximate the ideal is often determined statistically.
â end note]
templateconcept uniform_random_bit_generator =invocable<G&> && unsigned_integral<invoke_result_t<G&>> &&requires {{ G::min() } -> same_as<invoke_result_t<G&>>; { G::max() } -> same_as<invoke_result_t<G&>>; requires bool_constant<(G::min() < G::max())>::value; };
Let g be an object of type G.
G modelsuniform_random_bit_generator only if
G::min() <= g(),
g() <= G::max(), and
g() has amortized constant complexity.
A class G meets the uniform random bit generator requirements ifG models uniform_random_bit_generator,invoke_result_t<G&> is an unsigned integer type ([basic.fundamental]), andG provides a nested typedef-name result_type that denotes the same type as invoke_result_t<G&>.