std::UniformRandomBitGenerator

Defined in header <random>
template <class G>
concept UniformRandomBitGenerator =
  std::Invocable<G&> &&
  std::UnsignedIntegral<std::invoke_result_t<G&>> &&
  requires {
    G::min(); requires std::Same<decltype(G::min()), std::invoke_result_t<G&>>;
    G::max(); requires std::Same<decltype(G::max()), std::invoke_result_t<G&>>;
  };
(since C++20)

The concept UniformRandomBitGenerator <G> specifies that G is the type of a uniform random bit generator, that is, objects 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.

UniformRandomBitGenerator<G> is satisfied only if, given any object g of type G:

  • G::min() and G::max() are constant expressions;
  • G::min() < G::max()
  • g() is in the range [G::min(), G::max()]
  • g() has amortized constant complexity.

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/numeric/random/UniformRandomBitGenerator