std::uniform_random_bit_generator(3cxx)

πŸ’– NAME πŸ’–

okay so bestie, this is std::uniform_random_bit_generator β€” and it's literally the requirements for a uniform random bit generator. that's the whole vibe. no cap. ✨

it lives in the 3cxx manual section, in case you were wondering where to find it in your man setup πŸŽ€


✨ SYNOPSIS ✨

first thing you do, every time, is pull in the goods:

#include <random>

πŸ¦‹ Concept definition πŸ¦‹

here's the whole concept, verbatim, because you deserve the real thing and not a paraphrase:

template<typename _Gen>
concept std::uniform_random_bit_generator =  invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>>
      && requires
      {
        { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
        { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
        requires bool_constant<(_Gen::min() < _Gen::max())>::value;
      }

like… look at her. she's doing so much. _Gen& has to be invocable, the result of invoking it has to be an unsigned integral type, _Gen::min() and _Gen::max() both have to return exactly that same type, and _Gen::min() has to be strictly less than _Gen::max(). the way that she checks all of that at compile time πŸ˜­πŸ‘‘


🌸 Detailed Description 🌸

Requirements for a uniform random bit generator. πŸ’…

Since

C++20 ⭐

fr fr, if your compiler isn't feeling C++20, this concept is not gonna show up for you. that's just the situation.

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. πŸ€– (not me writing this by hand, the robot did it, but I'm the one making it cute 🫢)


and that's the whole page bestie!! this one came out of libstdc++ β€” the footer even reads libststd::uniform_random_bit_generator(3cxx), which, yeah, that's what it says, I'm not editing it, I'm just reporting it πŸ™ˆβœ¨ go forth and generate your bits, uniformly, iconic behaviour only πŸ’–πŸŒˆ

πŸ“¦ where this page comes from