std::unifor...distribution(3)
π std::unifor...distribution(3) π
okay so bestie, welcome to the C++ Standard Libary manual page for std::unifor...distribution(3) β and yes, we're keeping that exact spelling, periodt. This page is all about the std::uniform_real_distribution::uniform_real_distribution constructor, and it's giving "let me construct a new distribution object for u" energy. π
β¨
πΈ NAME πΈ
std::uniform_real_distribution::uniform_real_distribution β std::uniform_real_distribution::uniform_real_distribution
That's the constructor name, repeated exactly like the original, no cap. π«Ά
π¦ Synopsis π¦
lowkey the whole synopsis is right here, bestie β copy it exactly, don't touch the RealType:
uniform_real_distribution() : uniform_real_distribution(0.0) { }
(1) (since C++11)
explicit uniform_real_distribution( RealType a, RealType b = 1.0
(2) (since C++11)
);
explicit uniform_real_distribution( const param_type& params );
(3) (since C++11)
Constructs a new distribution object.
- Uses
aandbas the distribution parameters. - Uses
paramsas the distribution parameters.
β¨ Parameters β¨
aβ theadistribution parameter (minimum value).bβ thebdistribution parameter (maximum value).paramsβ the distribution parameter set.
π«Ά Notes π«Ά
Requires that a β€ b and b - a β€ std::numeric_limits<RealType>::max().
bestie, ifa == b, subsequent calls to theoperator()overload that does not accept aparam_typeobject will cause undefined behavior. That's not a vibe check you wanna fail. π
To create a distribution over the closed interval [a,b], std::nextafter(b, std::numeric_limits<RealType>::max()) may be used as the second parameter.
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
The columns are DR, Applied to, Behavior as published, and Correct behavior:
P0935R0β applied toC++11; behavior as published:default constructor was explicit; correct behavior:made implicit.
source/version: http://cppreference.com Β· date: 2024.06.10 Β· page: std::unifor...distribution(3) β mwah, slay, bye 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