std::uniform_real(3)

πŸ“¦ version 4.4.0, in nixpkgs unstable

🌸 std::uniform_real(3) 🌸

okay so bestie, welcome to the std::uniform_real page, straight out of the Library Functions Manual β€” yes that's the manual name, we're getting it out of the way early because this page is a whole vibe and we have things to read πŸ’…


✨ NAME ✨

std::uniform_real β€” Uniform continuous distribution for random numbers. that's it, that's the pitch, and honestly? iconic.


πŸ¦‹ SYNOPSIS πŸ¦‹

πŸ’œ Public Types

  • typedef _RealType input_type
  • typedef _RealType result_type

πŸŽ€ Public Member Functions

  • result_type max () const
  • result_type min () const
  • template<class _UniformRandomNumberGenerator > result_type operator() (_UniformRandomNumberGenerator &__urng)
  • void reset ()
  • uniform_real (_RealType __min=_RealType(0), _RealType __max=_RealType(1))

🌈 Friends

  • template<typename _RealType1 , typename _CharT , typename _Traits > std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const uniform_real< _RealType1 > &__x)
  • template<typename _RealType1 , typename _CharT , typename _Traits > std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, uniform_real< _RealType1 > &__x)

🌸 Detailed Description 🌸

template<typename _RealType = double> class std::uniform_real< _RealType >

Uniform continuous distribution for random numbers. literally what it says on the tin, no notes πŸ’–

so the way this works: it's a continuous random distribution on the range [min, max) β€” note the half-open bracket situation, bestie, min is in, max is out β€” with equal probability throughout the whole range. every value in there is equally likely, nobody's the favourite child 🫢

and hear me on this one: the URNG should be real-valued and deliver numbers in the range [0, 1). that's the requirement, don't come at it with something else, okay?? 😭

πŸ“ Definition at line 2059 of file tr1_impl/random.


🧚 Constructor & Destructor Documentation 🧚

⭐ template<typename _RealType = double> std::uniform_real< _RealType >::uniform_real (_RealType __min = _RealType(0), _RealType __max = _RealType(1)) [inline, explicit]

Constructs a uniform_real object. yes bestie, we're building one, this is the moment πŸ‘‘

Parameters:

  • ___min [IN] β€” The lower bound of the distribution.
  • ___max [IN] β€” The upper bound of the distribution.

πŸ“ Definition at line 2074 of file tr1_impl/random.


πŸ’« template<typename _RealType = double> template<typename _RealType1 , typename _CharT , typename _Traits > std::basic_ostream<_CharT, _Traits>& operator<< (std::basic_ostream< _CharT, _Traits > & __os, const uniform_real< _RealType1 > & __x) [friend]

Inserts a uniform_real random number distribution __x into the output stream __os. it's giving "let me introduce you to my friend, the stream" ✨

Parameters:

  • ___os β€” An output stream.
  • ___x β€” A uniform_real random number distribution.

Returns:

The output stream with the state of __x inserted or in an error state. (so either the data made it in, or the stream's having a bad day πŸ’€)


🌟 template<typename _RealType = double> template<typename _RealType1 , typename _CharT , typename _Traits > std::basic_istream<_CharT, _Traits>& operator>> (std::basic_istream< _CharT, _Traits > & __is, uniform_real< _RealType1 > & __x) [friend]

Extracts a uniform_real random number distribution __x from the input stream __is. reading it back out, the reverse slay 🌸

Parameters:

  • ___is β€” An input stream.
  • ___x β€” A uniform_real 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. not a human, a machine, and honestly it ate πŸ™ˆ


and that's the page bestie, hope you feel so informed rn πŸ’…

🫢 cute little sign-off: this gorgeous thing came from libstdc++, dated 21 Apr 2009, and it's page std::uniform_real(3) β€” go forth and generate your random reals, no cap πŸŽ€

πŸ“¦ where this page comes from