std::negati...distribution(3)
π std::negati...distribution(3) π
okay so we're in the C++ Standard Libary manual β yes, Libary with one r, that's the header's spelling, not me π β and this page is std::negati...distribution(3). The main character is std::negative_binomial_distribution::negative_binomial_distribution, which is literally the constructor. constructor inception, bestie.
πΈ NAME πΈ
std::negative_binomial_distribution::negative_binomial_distribution β std::negative_binomial_distribution::negative_binomial_distribution. That's the name. It's giving "say it twice so it knows it's iconic" energy. π
β¨ Synopsis β¨
negative_binomial_distribution() :
(1) (since C++11)
negative_binomial_distribution(1) {}
explicit negative_binomial_distribution( IntType k, double p = 0.5
(2) (since C++11)
);
explicit negative_binomial_distribution( const param_type& params
(3) (since C++11)
);
Constructs a new distribution object.
The numbered ones do this:
2)Useskandpas the distribution parameters.3)Usesparamsas the distribution parameters.
π Parameters π
kβ thekdistribution parameter (number of trial successes). success slay.pβ thepdistribution parameter (probability of a trial generatingtrue). probability core.paramsβ the distribution parameter set. the whole little bundle.
π§ Notes π§
Requires that 0 < p β€ 1 and 0 < k. Like, read those bounds before you come for this constructor, bestie.
β οΈ Ifp == 1, subsequent calls to theoperator()overload that does not accept aparam_typeobject will cause undefined behavior. That's the scary one β literally do not play with it. π
A default-constructed std::negative_binomial_distribution is equivalent to the default-constructed std::geometric_distribution. fr fr, they're twinning.
π 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 wasexplicitβ Correct behavior: madeimplicit. glow-up complete. β¨
π that's the whole page, bestie! source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::negati...distribution(3) β go construct something iconic π
β¨
π¦ 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