STD::NEGATIVE_BINOMIAL_DISTRIBUTION(3cxx)
πΈ NAME πΈ
std::negative_binomial_distribution< _IntType > β a negative_binomial_distribution random number distribution, and yes bestie it's giving main-character template energy β¨
okay so this is the 3cxx manual page for std::negative_binomial_distribution< _IntType > β the header line literally shows it as std::negative_...ion< _IntType >(3cxx), because even headers need a little nap sometimes π
π SYNOPSIS π
#include <random>
π¦ Classes π¦
struct param_type
π Public Types π
typedef _IntType result_type
π Public Member Functions π
negative_binomial_distribution (_IntType __k, double __p=0.5)negative_binomial_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)template<typename _UniformRandomNumberGenerator > void __generate (result_type *__f, result_type *__t, _UniformRandomNumberGenerator &__urng, const param_type &__p)_IntType k () constβ Return the$k$parameter 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)double p () constβ Return the$p$parameter of the distribution.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 _IntType1 , typename _CharT , typename _Traits > std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::negative_binomial_distribution< _IntType1 > &__x)β Inserts anegative_binomial_distributionrandom number distribution__xinto the output stream__os.bool operator== (const negative_binomial_distribution &__d1, const negative_binomial_distribution &__d2)β Return true if two negative binomial distributions have the same parameters and the sequences that would be generated are equal.template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, std::negative_binomial_distribution< _IntType1 > &__x)β Extracts anegative_binomial_distributionrandom number distribution__xfrom the input stream__is.
β¨ Detailed Description β¨
template<typename _IntType = int>
class std::negative_binomial_distribution< _IntType >
okay so this is a negative_binomial_distribution random number distribution. The page's raw text has a couple of tiny gremlin typos here (A nenative_binomial_distribution and Thm formula), but the formula it gives for the negative binomial probability mass function is:
$p(i) = {} p^i (1 - p)^{t - i}$
where $t$ and $p$ are the parameters of the distribution.
- Since: C++11
π Member Typedef Documentation π
template<typename _IntType = int> typedef _IntType std::negative_binomial_distribution< _IntType >::result_typeβ The type of the range of the distribution.
π¦ Member Function Documentation π¦
template<typename _IntType = int> _IntType std::negative_binomial_distribution< _IntType >::k () const [inline]β Return the$k$parameter of the distribution.template<typename _IntType = int> result_type std::negative_binomial_distribution< _IntType >::max () const [inline]β Returns the least upper bound value of the distribution.- References:
std::numeric_limits< _Tp >::max().
- References:
template<typename _IntType = int> result_type std::negative_binomial_distribution< _IntType >::min () const [inline]β Returns the greatest lower bound value of the distribution.template<typename _IntType > template<typename _UniformRandomNumberGenerator > negative_binomial_distribution< _IntType >::result_type std::negative_binomial_distribution< _IntType >::operator() (_UniformRandomNumberGenerator & __urng)β Generating functions.template<typename _IntType = int> double std::negative_binomial_distribution< _IntType >::p () const [inline]β Return the$p$parameter of the distribution.template<typename _IntType = int> param_type std::negative_binomial_distribution< _IntType >::param () const [inline]β Returns the parameter set of the distribution.template<typename _IntType = int> void std::negative_binomial_distribution< _IntType >::param (const param_type & __param) [inline]β Sets the parameter set of the distribution.- Parameters:
__paramβ the new parameter set of the distribution.
- Parameters:
template<typename _IntType = int> void std::negative_binomial_distribution< _IntType >::reset () [inline]β Resets the distribution state.- References:
std::gamma_distribution< _RealType >::reset().
- References:
π Friends And Related Symbol Documentation π
template<typename _IntType = int> template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > & __os, const std::negative_binomial_distribution< _IntType1 > & __x) [friend]β Inserts anegative_binomial_distributionrandom number distribution__xinto the output stream__os.- Parameters:
__osβ an output stream.__xβ anegative_binomial_distributionrandom number distribution.
- Returns: the output stream with the state of
__xinserted or in an error state.
- Parameters:
template<typename _IntType = int> bool operator== (const negative_binomial_distribution< _IntType > & __d1, const negative_binomial_distribution< _IntType > & __d2) [friend]β Return true if two negative binomial distributions have the same parameters and the sequences that would be generated are equal.template<typename _IntType = int> template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > & __is, std::negative_binomial_distribution< _IntType1 > & __x) [friend]β Extracts anegative_binomial_distributionrandom number distribution__xfrom the input stream__is.- Parameters:
__isβ an input stream.__xβ anegative_binomial_distributionrandom number generator engine.
- Returns: the input stream with
__xextracted or in an error state.
- Parameters:
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. icons only, no cap π«Ά
π cute little sign-off bestie π β source/version: libstdc++, Doxygen-generated from the source code. Footer/version string on the page: libstdstd::negative_...ion< _IntType >(3cxx). Date: the original page doesn't print one, so I'm not inventing a date, periodt πβ¨
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms