STD::DISCRETE_DISTRIBUTION(3cxx)

πŸ’… NAME πŸ’…

std::discrete_distribution< _IntType > β€” bestie, this is the 3cxx manual page for a discrete_distribution random number distribution. It's giving C++ class template realness, not a CLI tool, but the lore is still iconic. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <random>

πŸŽ€ Classes πŸŽ€

  • struct param_type

🌈 Public Types 🌈

  • typedef _IntType result_type

✨ Public Member Functions ✨

  • template<typename _InputIterator > discrete_distribution (_InputIterator __wbegin, _InputIterator __wend) β€” constructor overload, no extra deets here.
  • discrete_distribution (const param_type &__p) β€” constructor overload, periodt.
  • discrete_distribution (initializer_list< double > __wl) β€” constructor overload from an initializer list.
  • template<typename _Func > discrete_distribution (size_t __nw, double __xmin, double __xmax, _Func __fw) β€” constructor overload with a function vibe.
  • template<typename _ForwardIterator , typename _UniformRandomNumberGenerator > void __generate (_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator &__urng) β€” generate internals, listed exactly as the page says.
  • template<typename _ForwardIterator , typename _UniformRandomNumberGenerator > void __generate (_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator &__urng, const param_type &__p) β€” same energy, now with const param_type &__p.
  • template<typename _UniformRandomNumberGenerator > void __generate (result_type *__f, result_type *__t, _UniformRandomNumberGenerator &__urng, const param_type &__p) β€” pointer-style generate internals.
  • 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) β€” the other generating-function overload.
  • param_type param () const β€” returns the parameter set of the distribution.
  • void param (const param_type &__param) β€” sets the parameter set of the distribution.
  • std::vector< double > probabilities () const β€” returns the probabilities 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::discrete_distribution< _IntType1 > &__x) β€” inserts a discrete_distribution random number distribution __x into the output stream __os.
  • bool operator== (const discrete_distribution &__d1, const discrete_distribution &__d2) β€” return true if two discrete distributions have the same parameters.
  • template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, std::discrete_distribution< _IntType1 > &__x) β€” extracts a discrete_distribution random number distribution __x from the input stream __is.

πŸŒ€ Detailed Description πŸŒ€

template<typename _IntType = int>
class std::discrete_distribution< _IntType >"A discrete_distribution random number distribution.

This distribution produces random numbers $ i, 0 i < n $, distributed according to the probability mass function $ p(i | p_0, ..., p_{n-1}) = p_i $.

Since: C++11


🧚 Member Typedef Documentation 🧚

  • template<typename _IntType = int> typedef _IntType std::discrete_distribution< _IntType >::result_type β€” the type of the range of the distribution. πŸ’«

πŸ”₯ Member Function Documentation πŸ”₯

  • template<typename _IntType = int> result_type std::discrete_distribution< _IntType >::max () const [inline] β€” returns the least upper bound value of the distribution. References std::vector< _Tp, _Alloc >::empty(), and std::vector< _Tp, _Alloc >::size().
  • template<typename _IntType = int> result_type std::discrete_distribution< _IntType >::min () const [inline] β€” returns the greatest lower bound value of the distribution.
  • template<typename _IntType = int> template<typename _UniformRandomNumberGenerator > result_type std::discrete_distribution< _IntType >::operator() (_UniformRandomNumberGenerator & __urng) [inline] β€” generating functions. References std::discrete_distribution< _IntType >::operator()(). Referenced by std::discrete_distribution< _IntType >::operator()().
  • template<typename _IntType = int> param_type std::discrete_distribution< _IntType >::param () const [inline] β€” returns the parameter set of the distribution.
  • template<typename _IntType = int> void std::discrete_distribution< _IntType >::param (const param_type & __param) [inline] β€” sets the parameter set of the distribution.

Parameters

  • __param β€” the new parameter set of the distribution.
  • template<typename _IntType = int> std::vector< double > std::discrete_distribution< _IntType >::probabilities () const [inline] β€” returns the probabilities of the distribution. References std::vector< _Tp, _Alloc >::empty().
  • template<typename _IntType = int> void std::discrete_distribution< _IntType >::reset () [inline] β€” resets the distribution state.

  • 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::discrete_distribution< _IntType1 > & __x) [friend] β€” inserts a discrete_distribution random number distribution __x into the output stream __os.

Parameters

  • __os β€” an output stream.
  • __x β€” a discrete_distribution random number distribution.

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

  • template<typename _IntType = int> bool operator== (const discrete_distribution< _IntType > & __d1, const discrete_distribution< _IntType > & __d2) [friend] β€” return true if two discrete distributions have the same parameters. ✨
  • template<typename _IntType = int> template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > & __is, std::discrete_distribution< _IntType1 > & __x) [friend] β€” extracts a discrete_distribution random number distribution __x from the input stream __is.

Parameters

  • __is β€” an input stream.
  • __x β€” a discrete_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.


πŸ’Œ cute sign-off: this whole thing lives in the libstdc++ 3cxx manual set, and the supplied footer has no separate date line, so I’m not inventing one β€” no cap, bestie. bye and slay your random numbers πŸ«ΆπŸ’–

πŸ“¦ where this page comes from