STD::GAMMA_DISTRIBUTION(3)

🌸 NAME 🌸

std::gamma_distribution< _RealType > β€” a gamma continuous distribution for random numbers πŸ’– it's giving probability, bestie.

heads up: this whole thing lives in the Library Functions Manual, so that's the vibe of the page you're reading rn ✨

πŸ’… SYNOPSIS πŸ’…

#include <random>

πŸŽ€ Classes πŸŽ€

  • struct param_type

🌈 Public Types 🌈

  • typedef _RealType result_type

πŸ‘‘ Public Member Functions πŸ‘‘

  • gamma_distribution () β€” Constructs a gamma distribution with parameters 1 and 1 ✨
  • gamma_distribution (_RealType __alpha_val, _RealType __beta_val=_RealType(1)) β€” Constructs a gamma distribution with parameters $\alpha$ and $\beta$ πŸ’œ
  • gamma_distribution (const param_type &__p)
  • 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)
  • _RealType alpha () const β€” Returns the $\alpha$ of the distribution 🌸
  • _RealType beta () const β€” Returns the $\beta$ of the distribution πŸ¦‹
  • result_type max () const β€” Returns the least upper bound value 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 πŸ’«

🫢 Friends 🫢

  • template<typename _RealType1, typename _CharT, typename _Traits> std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::gamma_distribution< _RealType1 > &__x) β€” Inserts a gamma_distribution random number distribution __x into the output stream __os πŸ’–
  • bool operator== (const gamma_distribution &__d1, const gamma_distribution &__d2) β€” Return true if two gamma distributions have the same parameters and the sequences that would be generated are equal ✨
  • template<typename _RealType1, typename _CharT, typename _Traits> std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, std::gamma_distribution< _RealType1 > &__x) β€” Extracts a gamma_distribution random number distribution __x from the input stream __is πŸ’œ

🌟 Detailed Description 🌟

template<typename _RealType = double>
class std::gamma_distribution< _RealType >

A gamma continuous distribution for random numbers. no cap, that's literally the whole point of it πŸ’…

The formula for the gamma probability density function is:

p(x|Ξ±,Ξ²) = x^(Ξ±-1) e^(-x/Ξ²) / (Ξ²^Ξ± Ξ“(Ξ±))
Since C++11 πŸ‘‘ the girlies have had this one in the standard library.

🧚 Member Typedef Documentation 🧚

template<typename _RealType = double>
typedef _RealType std::gamma_distribution< _RealType >::result_type

The type of the range of the distribution πŸŽ€ (i.e. what kind of number it hands you back).


πŸ“ Constructor & Destructor Documentation πŸ“

template<typename _RealType = double>
std::gamma_distribution< _RealType >::gamma_distribution () [inline]

Constructs a gamma distribution with parameters 1 and 1 ✨ defaults stay winning.

template<typename _RealType = double>
std::gamma_distribution< _RealType >::gamma_distribution (_RealType __alpha_val, _RealType __beta_val = _RealType(1)) [inline], [explicit]

Constructs a gamma distribution with parameters $\alpha$ and $\beta$ πŸ’– note the [explicit] bestie, she does not do sneaky implicit conversions.


πŸ’€ Member Function Documentation πŸ’€

template<typename _RealType = double>
_RealType std::gamma_distribution< _RealType >::alpha () const [inline]

Returns the $\alpha$ of the distribution 🌸

template<typename _RealType = double>
_RealType std::gamma_distribution< _RealType >::beta () const [inline]

Returns the $\beta$ of the distribution πŸ¦‹

template<typename _RealType = double>
result_type std::gamma_distribution< _RealType >::max () const [inline]

Returns the least upper bound value of the distribution ⭐

template<typename _RealType = double>
result_type std::gamma_distribution< _RealType >::min () const [inline]

Returns the greatest lower bound value of the distribution ⭐

template<typename _RealType = double>
template<typename _UniformRandomNumberGenerator>
result_type std::gamma_distribution< _RealType >::operator() (_UniformRandomNumberGenerator & __urng) [inline]

Generating functions πŸ”₯

Referenced by operator()().

template<typename _RealType>
template<typename _UniformRandomNumberGenerator>
gamma_distribution< _RealType >::result_type std::gamma_distribution< _RealType >::operator() (_UniformRandomNumberGenerator & __urng, const param_type & __param)

Marsaglia, G. and Tsang, W. W. "A Simple Method for Generating Gamma Variables" ACM Transactions on Mathematical Software, 26, 3, 363-372, 2000 πŸ“š (yes she cited her sources, academic queen behavior).

References std::log(), and std::pow().

template<typename _RealType = double>
param_type std::gamma_distribution< _RealType >::param () const [inline]

Returns the parameter set of the distribution πŸŽ€

template<typename _RealType = double>
void std::gamma_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::gamma_distribution< _RealType >::reset () [inline]

Resets the distribution state πŸ’« fresh start energy.


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::gamma_distribution< _RealType1 > & __x) [friend]

Inserts a gamma_distribution random number distribution __x into the output stream __os πŸ’–

Parameters

  • __os β€” An output stream.
  • __x β€” A gamma_distribution random number distribution.

Returns

The output stream with the state of __x inserted or in an error state.

template<typename _RealType = double>
bool operator== (const gamma_distribution< _RealType > & __d1, const gamma_distribution< _RealType > & __d2) [friend]

Return true if two gamma distributions have the same parameters and the sequences that would be generated are equal ✨ twin check fr fr.

template<typename _RealType = double>
template<typename _RealType1, typename _CharT, typename _Traits>
std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > & __is, std::gamma_distribution< _RealType1 > & __x) [friend]

Extracts a gamma_distribution random number distribution __x from the input stream __is πŸ’œ

Parameters

  • __is β€” An input stream.
  • __x β€” A gamma_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. (not a human author, just a robot doing its little thing πŸ€–βœ¨)


okay that's the whole page bestie, slay 🫢 this came out of the Library Functions Manual as part of libstdc++, page std::gamma...RealType >(3), and the footer didn't hand us a date, so that's genuinely all the version/date tea we got 🌸 go generate some gamma variables, periodt πŸ’…

πŸ“¦ 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
  • centos-stream 10: gcc-toolset-15-libstdc++-docs 15.2.1-8.1.el10 Β· 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
  • centos-stream 10: gcc-toolset-16-libstdc++-docs 16.2.1-1.3.el10 Β· 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 43: libstdc++-docs 15.2.1-2.fc43 Β· 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 43: libstdc++-docs 15.3.1-1.fc43 Β· 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.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