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__xinto 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__xfrom 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.
π 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::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