std::bernou...distribution(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– std::bernou...distribution(3) β€” constructor era πŸ’–

okay so bestie, welcome to the std::bernou...distribution(3) page from the C++ Standard Libary manual. yes, that spelling is staying exactly as it appears, we do not edit the source material πŸ’…


🌸 NAME 🌸

std::bernoulli_distribution::bernoulli_distribution β€” literally the constructor for std::bernoulli_distribution, aka the thing that constructs the distribution object. icon behavior, no cap.


✨ Synopsis ✨

three overloads, all since C++11, all here to construct a new distribution object. the exact shape is:

          bernoulli_distribution() : bernoulli_distribution(0.5) { }   (1)
       (since C++11)
          explicit bernoulli_distribution( double p );                 (2)
       (since C++11)
          explicit bernoulli_distribution( const param_type& params ); (3)
       (since C++11)

so what's the tea:

  • overload 1 is the default one, and its code delegates to bernoulli_distribution(0.5) β€” cute.
  • overload 2 uses p as the distribution parameter.
  • overload 3 uses params as the distribution parameter.

all of them construct a new distribution object. periodt 🫢


πŸŽ€ Parameters πŸŽ€

  • p β€” the p distribution parameter (probability of generating true). yes bestie, it's giving probability realness 🌈
  • params β€” the distribution parameter set.

πŸ‘‘ Defect reports πŸ‘‘

okay so these behavior-changing defect reports were applied retroactively to previously published C++ standards. not me learning lore from the archives 😭

  • P0935R0 β€” applied to C++11 β€” behavior as published: the default constructor was explicit; correct behavior: made implicit.

that's the whole page, bestie πŸ’– source: http://cppreference.com Β· date: 2024.06.10 Β· C++ Standard Libary manual, signing off with main character energy πŸŒŸπŸ’…

πŸ“¦ where this page comes from