std::normal...distribution(3)
okay bestie, we're on the std::normal...distribution(3) page from the C++ Standard Libary manual β yep, that's how the header spells it, we keep it π
. This is the constructor page for std::normal_distribution, and it's lowkey iconic.
π NAME π
std::normal_distribution::normal_distribution β std::normal_distribution::normal_distribution. That's the whole NAME line, fr fr. It's the constructor constructor moment π
β¨ Synopsis β¨
Three overloads, all (since C++11), and the code is exactly this:
normal_distribution() : normal_distribution(0.0) {}
(1) (since C++11)
explicit normal_distribution( RealType mean, RealType stddev = 1.0
(2) (since C++11)
);
explicit normal_distribution( const param_type& params );
(3) (since C++11)
Calling any of these constructs a new distribution object π«Ά.
- 2) Uses
meanandstddevas the distribution parameters. - 3) Uses
paramsas the distribution parameters.
π¨ and bestie, read this part twice: the behavior is undefined if stddev is not greater than zero. Not "oops maybe", not "sorta weird" β undefined behavior, periodt ππ.
π Parameters π
meanβ the ΞΌ distribution parameter (mean) β¨stddevβ the Ο distribution parameter (standard deviation) πparamsβ the distribution parameter set π
π¦ Defect reports π¦
The following behavior-changing defect reports were applied retroactively to previously published C++ standards, so they're giving "we fixed it after the fact" energy π:
- DR
P0935R0β applied to C++11; behavior as published: default constructor wasexplicit; correct behavior: madeimplicit.
Okay bestie, that's the whole page π β source: http://cppreference.com, date/version: 2024.06.10, page: std::normal...distribution(3). Go forth and distribute normally, no cap ππ
π¦ 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