12 Numerics library [numerics]

Header <experimental/ranges/random> synopsis

namespace std { namespace experimental { namespace ranges { inline namespace v1 {
  template <class G>
  concept bool UniformRandomNumberGenerator = see below;
}}}}

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

template <class G>
concept bool UniformRandomNumberGenerator =
  Invocable<G&> &&
  UnsignedIntegral<result_of_t<G&()>> &&
  requires {
    { G::min() } -> Same<result_of_t<G&()>>&&;
    { G::max() } -> Same<result_of_t<G&()>>&&;
  };

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 ]

Let g be any object of type G. UniformRandomNumberGenerator<G> is satisfied only if

  • Both G::min() and G::max() are constant expressions ( ISO/IEC 14882:2014 §[expr.const]).

  • G::min() < G::max().

  • G::min() <= g().

  • g() <= G::max().

  • g() has amortized constant complexity.