std::binomi...distribution(3)
π 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β thetdistribution parameter (number of trials) π’pβ thepdistribution parameter (probability of a trial generatingtrue) π²paramsβ the distribution parameter set π
π¦ Notes π¦
Requires that 0 β€ p β€ 1 and 0 β€ t.
π¨ requirement check, bestie:phas to sit between0and1inclusive, andtcan'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
- Applied to:
π 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
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms