std::variate_generator(3)

πŸ“¦ version 4.4.0, in nixpkgs unstable

🌸 NAME 🌸

std::variate_generator β€” bestie, it's giving "random numbers but make it fancy", okay? That's literally the whole vibe.

Oh also, hi, this is the std::variate_generator(3) page from the Library Functions Manual, since we're being official about it πŸ’…


✨ SYNOPSIS ✨

πŸ’– Public Types

  • typedef __gnu_cxx::__enable_if< is_arithmetic< result_type >::value, result_type >::__type _IsValidType β€” the little enable-if gatekeeper, no cap, it's just sitting there making sure your type is valid ✨
  • typedef _Dist distribution_type β€” cute lil' alias for the distribution, obsessed πŸŽ€
  • typedef _Engine engine_type β€” and here's the alias for the engine, periodt πŸ¦‹
  • typedef __detail::_Adaptor< _Engine, _Dist > engine_value_type β€” the adaptor type, iykyk 🧚
  • typedef _Dist::result_type result_type β€” the type of result that comes out the other end, iconic πŸ’œ

🌈 Public Member Functions

  • const distribution_type & distribution () const β€” hands you a const reference to the distribution 🫢
  • distribution_type & distribution () β€” same but non-const, main character energy ✨
  • const engine_value_type & engine () const β€” const reference to the engine, slay
  • engine_value_type & engine () β€” non-const engine reference, let's go πŸ’…
  • result_type max () const β€” the closed upper bound, fr fr
  • result_type min () const β€” the closed lower bound, also fr
  • template<typename _Tp > result_type operator() (_Tp __value) β€” takes a __value, lowkey enigmatic 😭
  • result_type operator() () β€” gives you the next value, the actual moment we've all been waiting for πŸ”₯
  • variate_generator (engine_type __eng, distribution_type __dist) β€” the constructor, hi bestie πŸ‘‘

πŸ¦‹ Detailed Description πŸ¦‹

template<typename _Engine, typename _Dist> class std::variate_generator< _Engine, _Dist >

Okay so here's the tea: this thing produces random numbers on a given distribution function using a non-uniform random number generation engine. Not uniform. Non-uniform. She's picky and we love her for it πŸ’–

Todo: the engine_value_type needs to be studied more carefully. (Bestie the docs are literally admitting they don't fully get it yet and honestly? relatable πŸ™ˆ)

Definition at line 218 of file tr1_impl/random.


πŸŽ€ Constructor & Destructor Documentation πŸŽ€

template<typename _Engine , typename _Dist > std::variate_generator< _Engine , _Dist >::variate_generator (engine_type __eng, distribution_type __dist) [inline]

Constructs a variate generator, and like… it's using the uniform random number generator __eng for the random distribution __dist. So __eng feeds it, __dist shapes it, match made in heaven 🌸

Exceptions: any exceptions which may thrown by the copy constructors of the _Engine or _Dist objects. So yeah, if those copy constructors decide to act up, it's on them 😭

Definition at line 242 of file tr1_impl/random.


🌟 Member Function Documentation 🌟

template<typename _Engine , typename _Dist > const distribution_type& std::variate_generator< _Engine , _Dist >::distribution () const [inline]

Gets a const reference to the underlying random distribution. Peek but don't touch vibes 🫢

Definition at line 287 of file tr1_impl/random.

template<typename _Engine , typename _Dist > distribution_type& std::variate_generator< _Engine , _Dist >::distribution () [inline]

Gets a reference to the underlying random distribution β€” this one you can touch, go off πŸ‘‘

Definition at line 280 of file tr1_impl/random.

Referenced by std::variate_generator< _Engine , _Dist >::max(), and std::variate_generator< _Engine , _Dist >::min().

template<typename _Engine , typename _Dist > const engine_value_type& std::variate_generator< _Engine , _Dist >::engine () const [inline]

Gets a const reference to the underlying uniform random number generator object. The engine said no pictures please πŸ“Έ

Definition at line 273 of file tr1_impl/random.

template<typename _Engine , typename _Dist > engine_value_type& std::variate_generator< _Engine , _Dist >::engine () [inline]

Gets a reference to the underlying uniform random number generator object β€” non-const edition, so you can actually poke at it πŸ’…

Definition at line 265 of file tr1_impl/random.

template<typename _Engine , typename _Dist > result_type std::variate_generator< _Engine , _Dist >::max () const [inline]

Gets the closed upper bound of the distribution interval. The ceiling, literally 🌈

Definition at line 301 of file tr1_impl/random.

References std::variate_generator< _Engine , _Dist >::distribution().

template<typename _Engine , typename _Dist > result_type std::variate_generator< _Engine , _Dist >::min () const [inline]

Gets the closed lower bound of the distribution interval. The floor, also literally πŸ“

Definition at line 294 of file tr1_impl/random.

References std::variate_generator< _Engine , _Dist >::distribution().

template<typename _Engine , typename _Dist > template<typename _Tp > result_type std::variate_generator< _Engine , _Dist >::operator() (_Tp __value) [inline]

WTF? 😭 That's it. That's the whole description. The documentation team truly said "no thoughts, head empty" and I respect the honesty πŸ’€

Definition at line 257 of file tr1_impl/random.

template<typename _Engine , typename _Dist > result_type std::variate_generator< _Engine , _Dist >::operator() () [inline]

Gets the next generated value on the distribution. The payoff. The reveal. The moment πŸŽ€βœ¨

Definition at line 249 of file tr1_impl/random.


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. Not a human, just a robot doing its little robot thing πŸ€–πŸ’–


Okay that's the whole page bestie, you ate that πŸ’…βœ¨ Cute little sign-off: this was libstdc++, dated 21 Apr 2009, and the page is std::variate_generator(3) β€” go forth and generate some variates, icon πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from