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 a normal_distribution random number distribution __x into the output stream __os. 🫢
  • template<typename _RealType1> bool operator== (const std::normal_distribution< _RealType1 > &__d1, const std::normal_distribution< _RealType1 > &__d2) β€” return true if 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 a normal_distribution random number distribution __x from 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.


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 β€” a normal_distribution random number distribution.

Returns

  • the output stream with the state of __x inserted 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 β€” a normal_distribution random number generator engine.

Returns

  • the input stream with __x extracted 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