STD::UNIFORM_REAL_DISTRIBUTION(3)

πŸ’– std::uniform_real_distribution< _RealType > πŸ’–

okay so bestie, welcome to the Library Functions Manual, section 3, and this page is literally called std::uniform_real_distribution< _RealType >(3). it's giving random numbers, it's giving C++ <random> energy, and we're gonna go through every single thing on it together, no skipping, periodt. πŸŽ€


✨ NAME ✨

std::uniform_real_distribution< _RealType > β€” Uniform continuous distribution for random numbers.

that's it. that's the whole name. iconic, honestly. πŸ’…


🌸 SYNOPSIS 🌸

#include <random>

🫢 Classes

  • struct param_type β€” it's here! the page lists it and gives us zero extra description, so we simply respect the mystery. πŸ™ˆ

πŸ¦‹ Public Types

  • typedef _RealType result_type β€” the type of the range of the distribution, aka the flavour of number you're gonna be pulling out of this thing. ⭐

πŸ‘‘ Public Member Functions

  • uniform_real_distribution () β€” Constructs a uniform_real_distribution object.
  • uniform_real_distribution (_RealType __a, _RealType __b=_RealType(1)) β€” Constructs a uniform_real_distribution object.
  • uniform_real_distribution (const param_type &__p) β€” constructs one from a param_type, and yes we are listing it because it is on the page. 😌
  • template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate (_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator &__urng) β€” it's there, it's templated, we copy it exactly, no notes.
  • template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate (_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator &__urng, const param_type &__p) β€” same situation, now with a param_type in the mix.
  • template<typename _UniformRandomNumberGenerator> void __generate (result_type *__f, result_type *__t, _UniformRandomNumberGenerator &__urng, const param_type &__p) β€” the pointer-flavoured one, still exact, still here.
  • result_type a () const β€” on the list. that's the assignment. πŸ’œ
  • result_type b () const β€” also on the list. matching set, cute.
  • result_type max () const β€” Returns the inclusive upper bound of the distribution range.
  • result_type min () const β€” Returns the inclusive lower bound of the distribution range.
  • template<typename _UniformRandomNumberGenerator> result_type operator() (_UniformRandomNumberGenerator &__urng) β€” Generating functions.
  • template<typename _UniformRandomNumberGenerator> result_type operator() (_UniformRandomNumberGenerator &__urng, const param_type &__p) β€” the two-argument sibling, sitting right below it like it belongs there (it does).
  • 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 uniform_real_distribution &__d1, const uniform_real_distribution &__d2) β€” Return true if two uniform real distributions have the same parameters.

πŸ”₯ Detailed Description πŸ”₯

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

"Uniform continuous distribution for random numbers."

A continuous random distribution on the range [min, max) with equal probability throughout the range. The URNG should be real-valued and deliver number in the range [0, 1).

Since: C++11

bestie, clock the range notation: it's [min, max) β€” square bracket on the left, round bracket on the right. that means the top end is not included. do not come for me, that's what the page says. 😭

⭐ Member Typedef Documentation ⭐

template<typename _RealType = double> typedef _RealType
    std::uniform_real_distribution< _RealType >::result_type

The type of the range of the distribution.


🧚 Constructor & Destructor Documentation 🧚

template<typename _RealType = double> std::uniform_real_distribution< _RealType >::uniform_real_distribution () [inline]

Constructs a uniform_real_distribution object. The lower bound is set to 0.0 and the upper bound to 1.0

template<typename _RealType = double> std::uniform_real_distribution< _RealType >::uniform_real_distribution (_RealType __a, _RealType __b = _RealType(1)) [inline], [explicit]

Constructs a uniform_real_distribution object.

Parameters

  • __a [IN] β€” The lower bound of the distribution.
  • __b [IN] β€” The upper bound of the distribution.
it's marked [explicit], bestie, so no sneaky implicit conversions. respect the boundary. πŸ’…

πŸ’œ Member Function Documentation πŸ’œ

template<typename _RealType = double> result_type std::uniform_real_distribution< _RealType >::max () const [inline]

Returns the inclusive upper bound of the distribution range.

template<typename _RealType = double> result_type std::uniform_real_distribution< _RealType >::min () const [inline]

Returns the inclusive lower bound of the distribution range.

template<typename _RealType = double> template<typename _UniformRandomNumberGenerator> result_type std::uniform_real_distribution< _RealType >::operator() (_UniformRandomNumberGenerator & __urng) [inline]

Generating functions.

Referenced by operator()().

template<typename _RealType = double> param_type std::uniform_real_distribution< _RealType >::param () const [inline]

Returns the parameter set of the distribution.

Referenced by std::operator>>().

template<typename _RealType = double> void std::uniform_real_distribution< _RealType >::param (const param_type & __param) [inline]

Sets the parameter set of the distribution.

Parameters

  • __param β€” The new parameter set of the distribution.

template<typename _RealType = double> void std::uniform_real_distribution< _RealType >::reset () [inline]

Resets the distribution state. Does nothing for the uniform real distribution.

not the reset () doing absolutely nothing for this distribution 😭 honestly? relatable. sometimes the most productive thing you can do is nothing. self-care king. 🌸

template<typename _RealType = double> bool operator== (const uniform_real_distribution< _RealType > & __d1, const uniform_real_distribution< _RealType > & __d2) [friend]

Return true if two uniform real distributions have the same parameters.


πŸ¦‹ Author πŸ¦‹

Generated automatically by Doxygen for libstdc++ from the source code.


so yeah. it's auto-generated, it's libstdc++, and nobody hand-wrote this β€” the robots did it and they ate. πŸ‘‘

okay that's the whole page, bestie, every single line accounted for, nothing skipped, nothing invented. this was libstdc++ bringing you the Library Functions Manual entry for std::unifo..._RealType >(3) β€” go forth and generate some floats, love u, byeee πŸ’–βœ¨πŸŒˆ

πŸ“¦ 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
  • centos-stream 10: gcc-toolset-15-libstdc++-docs 15.2.1-8.1.el10 Β· 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
  • centos-stream 10: gcc-toolset-16-libstdc++-docs 16.2.1-1.3.el10 Β· 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
  • centos-stream 10: libstdc++-docs 14.4.1-4.el10 Β· 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 43: libstdc++-docs 15.2.1-2.fc43 Β· 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 43: libstdc++-docs 15.3.1-1.fc43 Β· 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.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