std::uniform_int(3)
π std::uniform_int π
okay bestie, this is the std::uniform_int(3) page from the Library Functions Manual β manual name folded right up here near the top, cute and cozy, no boring header-line copy. β¨
πΈ NAME πΈ
std::uniform_int β Uniform discrete distribution for random numbers. A discrete random distribution on the range $[min, max]$ with equal probability throughout the range.
π¦ SYNOPSIS π¦
π Public Types π
typedef _IntType input_type
typedef _IntType result_type
β¨ Public Member Functions β¨
result_type max () const
result_type min () const
template<typename _UniformRandomNumberGenerator > result_type operator() (_UniformRandomNumberGenerator &__urng, result_type __n)
template<typename _UniformRandomNumberGenerator > result_type operator() (_UniformRandomNumberGenerator &__urng)
void reset ()
uniform_int (_IntType __min=0, _IntType __max=9)
π«Ά Friends π«Ά
template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const uniform_int< _IntType1 > &__x)
template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, uniform_int< _IntType1 > &__x)
π¦ Detailed Description π¦
template<typename _IntType = int> class std::uniform_int< _IntType >
Uniform discrete distribution for random numbers. A discrete random distribution on the range $[min, max]$ with equal probability throughout the range.
Definition at line 1560 of file tr1_impl/random.
π Member Typedef Documentation π
input_type
template<typename _IntType = int> typedef _IntType std::uniform_int< _IntType >::input_type
The type of the parameters of the distribution.
Definition at line 1566 of file tr1_impl/random.
result_type
template<typename _IntType = int> typedef _IntType std::uniform_int< _IntType >::result_type
The type of the range of the distribution.
Definition at line 1568 of file tr1_impl/random.
π Constructor & Destructor Documentation π
uniform_int
template<typename _IntType = int> std::uniform_int< _IntType >::uniform_int (_IntType __min = 0, _IntType __max = 9) [inline, explicit]
Constructs a uniform distribution object. Literally doing exactly what it says, iconic behavior. π
Definition at line 1575 of file tr1_impl/random.
π₯ Member Function Documentation π₯
max
template<typename _IntType = int> result_type std::uniform_int< _IntType >::max () const [inline]
Gets the inclusive upper bound of the distribution range.
Definition at line 1592 of file tr1_impl/random.
min
template<typename _IntType = int> result_type std::uniform_int< _IntType >::min () const [inline]
Gets the inclusive lower bound of the distribution range.
Definition at line 1585 of file tr1_impl/random.
operator() β the (__urng, __n) version
template<typename _IntType = int> template<typename _UniformRandomNumberGenerator > result_type std::uniform_int< _IntType >::operator() (_UniformRandomNumberGenerator & __urng, result_type __n) [inline]
Gets a uniform random number in the range $[0, n)$.
This function is aimed at use with std::random_shuffle.
Definition at line 1624 of file tr1_impl/random.
operator() β the (__urng) version
template<typename _IntType = int> template<typename _UniformRandomNumberGenerator > result_type std::uniform_int< _IntType >::operator() (_UniformRandomNumberGenerator & __urng) [inline]
Gets a uniformly distributed random number in the range $(min, max)$.
Definition at line 1609 of file tr1_impl/random.
reset
template<typename _IntType = int> void std::uniform_int< _IntType >::reset () [inline]
Resets the distribution state.
Does nothing for the uniform integer distribution.
Definition at line 1601 of file tr1_impl/random.
π Friends And Related Function Documentation π
operator<<
template<typename _IntType = int> template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_ostream<_CharT, _Traits>& operator<< (std::basic_ostream< _CharT, _Traits > & __os, const uniform_int< _IntType1 > & __x) [friend]
Inserts a uniform_int random number distribution __x into the output stream os.
- Parameters:
__osβ An output stream.__xβ Auniform_intrandom number distribution.
- Returns: The output stream with the state of
__xinserted or in an error state.
operator>>
template<typename _IntType = int> template<typename _IntType1 , typename _CharT , typename _Traits > std::basic_istream<_CharT, _Traits>& operator>> (std::basic_istream< _CharT, _Traits > & __is, uniform_int< _IntType1 > & __x) [friend]
Extracts a uniform_int random number distribution __x from the input stream __is.
- Parameters:
__isβ An input stream.__xβ Auniform_intrandom number generator engine.
- Returns: The input stream with
__xextracted or in an error state.
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
π Cute little sign-off: source/version islibstdc++, and the date is21 Apr 2009. That's the footer energy, folded in at the very end instead of copy-pasting the whole line. π
π¦ where this page comes from
- nixpkgs unstable: std-man-pages 4.4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms