Namespaces
Variants
Views
Actions

std::uniform_random_bit_generator

From cppreference.com
< cpp‎ | numeric‎ | random
 
 
 
Pseudo-random number generation
Uniform random bit generators
uniform_random_bit_generator
(C++20)
Engines and engine adaptors
Non-deterministic generator
Distributions
Uniform distributions
Bernoulli distributions
Poisson distributions
Normal distributions
Sampling distributions
Seed Sequences
(C++11)
C library
 
Defined in header <random>
template <class G>

concept uniform_random_bit_generator =
  std::invocable<G&> && std::unsigned_integral<std::invoke_result_t<G&>> &&
  requires {
    { G::min() } -> std::same_as<std::invoke_result_t<G&>>;
    { G::max() } -> std::same_as<std::invoke_result_t<G&>>;

  };
(since C++20)

The concept uniform_random_bit_generator<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.

uniform_random_bit_generator<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.