Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::uniform_random_bit_generator

      From cppreference.com
      <cpp‎ |numeric‎ |random
       
       
       
      Pseudo-random number generation
       
      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&>>;
              requiresstd::bool_constant<(G::min()< G::max())>::value;

         };
      (since C++20)

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

      [edit]Semantic requirements

      uniform_random_bit_generator<G> is modeled only if, given any objectg of typeG:

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

      [edit]Notes

      In order to satisfy the requirementstd::bool_constant<(G::min()< G::max())>::value, bothG::min() andG::max() must be constant expressions, and the result of the comparison must betrue.

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/random/uniform_random_bit_generator&oldid=153661"

      [8]ページ先頭

      ©2009-2025 Movatter.jp