STD::GEOMETRIC_DISTRIBUTION(3)

πŸ’– std::geometric_distribution< _IntType > πŸ’–

okay bestie, welcome to the Library Functions Manual, section 3, and yes we are talking about std::geometric_distribution< _IntType > today. it's a whole template class and it's lowkey iconic, let's get into it πŸŽ€


✨ NAME ✨

std::geometric_distribution< _IntType > β€” a discrete geometric random number distribution. that's it, that's the vibe. πŸ’…


🌸 SYNOPSIS 🌸

#include <random>

πŸ¦‹ Classes

  • struct param_type

πŸ¦‹ Public Types

  • typedef _IntType result_type

πŸ¦‹ Public Member Functions

  • geometric_distribution (const param_type &__p)
  • geometric_distribution (double __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)
  • result_type max () const β€” returns the least upper bound value of the distribution. the ceiling, bestie 🫢
  • result_type min () const β€” returns the greatest lower bound value of the distribution. the floor, fr fr
  • template<typename _UniformRandomNumberGenerator> result_type operator() (_UniformRandomNumberGenerator &__urng) β€” generating functions. this is the one that actually spits out numbers ✨
  • template<typename _UniformRandomNumberGenerator> result_type operator() (_UniformRandomNumberGenerator &__urng, const param_type &__p)
  • double p () const β€” returns the distribution parameter 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

  • bool operator== (const geometric_distribution &__d1, const geometric_distribution &__d2) β€” return true if two geometric distributions have the same parameters. twin check πŸ’–

πŸ‘‘ Detailed Description πŸ‘‘

template<typename _IntType = int>
class std::geometric_distribution< _IntType >

"A discrete geometric random number distribution.

the formula for the geometric probability density function is $p(i|p) = p(1 - p)^{i}$ where $p$ is the parameter of the distribution. like, that's the whole math girlie. ✨

Since

C++11 β€” so it's been serving since 2011, no cap πŸŽ€


πŸ’œ Member Typedef Documentation πŸ’œ

template<typename _IntType = int> typedef _IntType std::geometric_distribution< _IntType >::result_type

the type of the range of the distribution. that's what you get back, periodt. πŸ¦‹


🌈 Member Function Documentation 🌈

template<typename _IntType = int> result_type std::geometric_distribution< _IntType >::max () const [inline]

returns the least upper bound value of the distribution. the top of the range, bestie 🫢


template<typename _IntType = int> result_type std::geometric_distribution< _IntType >::min () const [inline]

returns the greatest lower bound value of the distribution. the bottom of the range, slay πŸ’…


template<typename _IntType = int> template<typename _UniformRandomNumberGenerator> result_type std::geometric_distribution< _IntType >::operator() (_UniformRandomNumberGenerator & __urng) [inline]

generating functions. 🎲

Referenced by operator()().


template<typename _IntType = int> double std::geometric_distribution< _IntType >::p () const [inline]

returns the distribution parameter p. 🌸


template<typename _IntType = int> param_type std::geometric_distribution< _IntType >::param () const [inline]

returns the parameter set of the distribution.

Referenced by std::operator>>().


template<typename _IntType = int> void std::geometric_distribution< _IntType >::param (const param_type & __param) [inline]

sets the parameter set of the distribution.

Parameters

  • __param β€” the new parameter set of the distribution. give it the new vibes πŸ’–

template<typename _IntType = int> void std::geometric_distribution< _IntType >::reset () [inline]

resets the distribution state. does nothing for the geometric distribution. so like, it's there, it's cute, it does absolutely nothing πŸ™ˆ not a bug, just how it is, fr fr.


template<typename _IntType = int> bool operator== (const geometric_distribution< _IntType > & __d1, const geometric_distribution< _IntType > & __d2) [friend]

return true if two geometric distributions have the same parameters. matching params = matching energy πŸ’―


πŸŽ€ Author πŸŽ€

generated automatically by Doxygen for libstdc++ from the source code. not me writing this by hand, it's giving robot-authored 😭


and that's the whole page bestie, go forth and generate those discrete geometric random numbers, you're the main character of <random> now πŸ‘‘

this lil manual page lives under libstdc++ and the page title was std::geome... _IntType >(3) β€” yeah it got cut off with an ellipsis, iconic of it honestly. mwah, bye! πŸ’–βœ¨πŸŽ€

πŸ“¦ 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