std::binomi...distribution(3)

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

πŸ’– NAME πŸ’–

okay so bestie, we're on the std::binomi...distribution(3) page, and the main character is std::binomial_distribution::binomial_distribution β€” from the C++ Standard Libary manual (that spelling is literally in the header, don't come for me πŸ’…). It's the constructor for the binomial distribution, and it's giving "i make distribution objects" energy. ✨

✨ Synopsis ✨

binomial_distribution() : binomial_distribution(1) {}        (1)
(since C++11)
explicit binomial_distribution( IntType t, double p = 0.5 ); (2)
(since C++11)
explicit binomial_distribution( const param_type& params );  (3)
(since C++11)

All three overloads are tagged (since C++11) β€” the code block is not playing around. 🫢

Constructs a new distribution object. That's the assignment, and it ate. πŸ’…

The numbered notes below pick up at (2), just like the page does β€” (1) is the default-constructor line above.

(2) uses t and p as the distribution parameters.

(3) uses params as the distribution parameter.

πŸŽ€ Parameters πŸŽ€

  • t β€” the t distribution parameter (number of trials) πŸ”’
  • p β€” the p distribution parameter (probability of a trial generating true) 🎲
  • params β€” the distribution parameter set πŸŽ€

πŸ¦‹ Notes πŸ¦‹

Requires that 0 ≀ p ≀ 1 and 0 ≀ t.

🚨 requirement check, bestie: p has to sit between 0 and 1 inclusive, and t can't be negative. That's the whole boundary vibe. periodt. πŸ’…

🌸 Defect reports 🌸

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

  • DR: P0935R0
    • Applied to: C++11
    • Behavior as published: default constructor was explicit
    • Correct behavior: made implicit

πŸ’– cute sign-off: source http://cppreference.com, version/date 2024.06.10, footer tag std::binomi...distribution(3). go forth and construct, bestie 🫢✨

πŸ“¦ where this page comes from