STD::NORMAL_DISTRIBUTION(3)
π std::normal_distribution< _RealType > π
okay bestie, sit down, hydrate, because today we're talking about a normal continuous distribution for random numbers from the C++ standard library β and it's literally one of the most iconic little guys in <random>. this is part of the Library Functions Manual, and no cap, it's giving statistics class but make it slay. π¦
β¨ NAME β¨
std::normal_distribution< _RealType > β a normal continuous distribution for random numbers. that's it, that's the vibe. πΈ
β¨ SYNOPSIS β¨
#include <random>
π Classes
struct param_type
π Public Types
typedef _RealType result_type
π Public Member Functions
normal_distribution (const param_type &__p)normal_distribution (result_type __mean, result_type __stddev=result_type(1))template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate (_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator &__urng)template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate (_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator &__urng, const param_type &__p)template<typename _UniformRandomNumberGenerator> void __generate (result_type *__f, result_type *__t, _UniformRandomNumberGenerator &__urng, const param_type &__p)result_type max () constβ returns the least upper bound value of the distribution. π_RealType mean () constβ returns the mean of the distribution. β¨result_type min () constβ returns the greatest lower bound value of the distribution.template<typename _UniformRandomNumberGenerator> result_type operator() (_UniformRandomNumberGenerator &__urng)β generating functions. π²template<typename _UniformRandomNumberGenerator> result_type operator() (_UniformRandomNumberGenerator &__urng, const param_type &__p)param_type param () constβ returns the parameter set of the distribution.void param (const param_type &__param)β sets the parameter set of the distribution.void reset ()β resets the distribution state. π_RealType stddev () constβ returns the standard deviation of the distribution.
π Friends
template<typename _RealType1, typename _CharT, typename _Traits> std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::normal_distribution< _RealType1 > &__x)β inserts anormal_distributionrandom number distribution__xinto the output stream__os. π«Άtemplate<typename _RealType1> bool operator== (const std::normal_distribution< _RealType1 > &__d1, const std::normal_distribution< _RealType1 > &__d2)β returntrueif two normal distributions have the same parameters and the sequences that would be generated are equal. equality, but make it thorough.template<typename _RealType1, typename _CharT, typename _Traits> std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, std::normal_distribution< _RealType1 > &__x)β extracts anormal_distributionrandom number distribution__xfrom the input stream__is. π
β¨ Detailed Description β¨
template<typename _RealType = double>
class std::normal_distribution< _RealType >
"A normal continuous distribution for random numbers.
The formula for the normal probability density function is
p(x|,ma) = ac{1}{ma t{2 i}}
e^{- ac{{x - }^ {2}}{2 ma ^ {2}} } ]
Since
- C++11
β¨ Member Typedef Documentation β¨
template<typename _RealType = double> typedef _RealType
std::normal_distribution< _RealType >::result_type
the type of the range of the distribution. iykyk. π
β¨ Constructor & Destructor Documentation β¨
template<typename _RealType = double> std::normal_distribution< _RealType
>::normal_distribution (result_type __mean, result_type __stddev =
result_type(1)) [inline], [explicit]
constructs a normal distribution with parameters $mean$ and standard deviation. periodt. π
β¨ Member Function Documentation β¨
template<typename _RealType = double> result_type std::normal_distribution<
_RealType >::max () const [inline]
returns the least upper bound value of the distribution.
template<typename _RealType = double> _RealType std::normal_distribution<
_RealType >::mean () const [inline]
returns the mean of the distribution.
template<typename _RealType = double> result_type std::normal_distribution<
_RealType >::min () const [inline]
returns the greatest lower bound value of the distribution.
template<typename _RealType = double> template<typename
_UniformRandomNumberGenerator> result_type std::normal_distribution<
_RealType >::operator() (_UniformRandomNumberGenerator & __urng)
[inline]
generating functions.
referenced by operator()().
template<typename _RealType> template<typename
_UniformRandomNumberGenerator> normal_distribution< _RealType
>::result_type std::normal_distribution< _RealType >::operator()
(_UniformRandomNumberGenerator & __urng, const param_type & __param)
polar method due to Marsaglia. π§
Devroye, L. Non-Uniform Random Variates Generation. Springer-Verlag, New York, 1986, Ch. V, Sect. 4.4.
references std::log(), and std::sqrt().
template<typename _RealType = double> param_type std::normal_distribution<
_RealType >::param () const [inline]
returns the parameter set of the distribution.
template<typename _RealType = double> void std::normal_distribution<
_RealType >::param (const param_type & __param) [inline]
sets the parameter set of the distribution.
Parameters
__paramβ the new parameter set of the distribution.
template<typename _RealType = double> void std::normal_distribution<
_RealType >::reset () [inline]
resets the distribution state.
template<typename _RealType = double> _RealType std::normal_distribution<
_RealType >::stddev () const [inline]
returns the standard deviation of the distribution.
β¨ Friends And Related Symbol Documentation β¨
template<typename _RealType = double> template<typename _RealType1, typename
_CharT, typename _Traits> std::basic_ostream< _CharT, _Traits > &
operator<< (std::basic_ostream< _CharT, _Traits > & __os, const
std::normal_distribution< _RealType1 > & __x) [friend]
inserts a normal_distribution random number distribution __x into the output stream __os.
Parameters
__osβ an output stream.__xβ anormal_distributionrandom number distribution.
Returns
- the output stream with the state of
__xinserted or in an error state.
template<typename _RealType = double> template<typename _RealType1> bool
operator== (const std::normal_distribution< _RealType1 > & __d1, const
std::normal_distribution< _RealType1 > & __d2) [friend]
return true if two normal distributions have the same parameters and the sequences that would be generated are equal.
template<typename _RealType = double> template<typename _RealType1, typename
_CharT, typename _Traits> std::basic_istream< _CharT, _Traits > &
operator>> (std::basic_istream< _CharT, _Traits > & __is,
std::normal_distribution< _RealType1 > & __x) [friend]
extracts a normal_distribution random number distribution __x from the input stream __is.
Parameters
__isβ an input stream.__xβ anormal_distributionrandom number generator engine.
Returns
- the input stream with
__xextracted or in an error state.
β¨ Author β¨
generated automatically by Doxygen for libstdc++ from the source code. π the robots wrote it, not me β I just gave it a glow-up.
π«Ά okay that's the whole page bestie, go forth and generate your gaussian noise with main character energy. no cap, you ate. π
libstdc++ Β· std::normal_distribution< _RealType >(3) β Library Functions Manual. mwah, stan the standard library. πβ¨π
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms