STD::CHI_SQUARED_DISTRIBUTION(3)

✨ std::chi_squared_distribution< _RealType > ✨

okay so bestie, this is a section-3 library manual page straight out of libstdc++, and we're talking about the iconic std::chi_squared_distribution< _RealType > β€” a whole random number distribution πŸ’…. Grab a strawberry drink, we're going in.


πŸŽ€ NAME πŸŽ€

std::chi_squared_distribution< _RealType > β€” a chi_squared_distribution random number distribution. that's it, that's the name, she's serving exactly what it says on the tin 🫢


🌸 SYNOPSIS 🌸

#include <random>

πŸ¦‹ Classes πŸ¦‹

  • struct param_type

⭐ Public Types ⭐

  • typedef _RealType result_type

πŸ‘‘ Public Member Functions πŸ‘‘

  • chi_squared_distribution (_RealType __n) β€” constructor, takes the __n parameter πŸ’–
  • chi_squared_distribution (const param_type &__p) β€” constructor that takes a param_type instead
  • template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate (_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator &__urng) β€” the internal generation hook, iterator-flavored
  • template<typename _ForwardIterator, typename _UniformRandomNumberGenerator> void __generate (_ForwardIterator __f, _ForwardIterator __t, _UniformRandomNumberGenerator &__urng, const param_type &__p) β€” same iterator-flavored hook but you also hand it a param_type
  • template<typename _UniformRandomNumberGenerator> void __generate (result_type *__f, result_type *__t, _UniformRandomNumberGenerator &__urng) β€” pointer-flavored version of the hook
  • template<typename _UniformRandomNumberGenerator> void __generate (result_type *__f, result_type *__t, _UniformRandomNumberGenerator &__urng, const param_type &__p) β€” pointer-flavored hook plus a param_type
  • 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
  • _RealType n () const β€” hands you back the n πŸ’«
  • template<typename _UniformRandomNumberGenerator> result_type operator() (_UniformRandomNumberGenerator &__urng) β€” generating functions ✨
  • template<typename _UniformRandomNumberGenerator> result_type operator() (_UniformRandomNumberGenerator &__urng, const param_type &__p) β€” generating, but with your own param_type
  • 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 🌈

  • template<typename _RealType1, typename _CharT, typename _Traits> std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::chi_squared_distribution< _RealType1 > &__x) β€” inserts a chi_squared_distribution random number distribution __x into the output stream __os
  • bool operator== (const chi_squared_distribution &__d1, const chi_squared_distribution &__d2) β€” return true if two Chi-squared distributions have the same parameters and the sequences that would be generated are equal
  • template<typename _RealType1, typename _CharT, typename _Traits> std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, std::chi_squared_distribution< _RealType1 > &__x) β€” extracts a chi_squared_distribution random number distribution __x from the input stream __is

πŸ’– Detailed Description πŸ’–

template<typename _RealType = double>
class std::chi_squared_distribution< _RealType >"A
    chi_squared_distribution random number distribution.

(yes the stray "A up there is literally in the page, we don't ask questions, we just respect her πŸ™ˆ)

The formula for the normal probability mass function is

$p(x|n) = ac{x^{(n/2) - 1}e^{-x/2}}{Gamma(n/2) 2^{n/2}}$

Since

C++11 β€” she's been around, she's a classic, no cap πŸ’œ


🧚 Member Typedef Documentation 🧚

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

The type of the range of the distribution. that's the vibe, that's the whole job πŸŽ€


🌸 Member Function Documentation 🌸

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

Returns the least upper bound value of the distribution. the ceiling, the limit, the "that's the most you're getting" πŸ”₯

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

Returns the greatest lower bound value of the distribution. the floor, the baseline, the starting line ⭐

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

Generating functions. this is the one you actually call, bestie πŸ’…

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

Returns the parameter set of the distribution. all the little settings, in a neat lil bundle 🎁

template<typename _RealType = double> void std::chi_squared_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::chi_squared_distribution<
    _RealType >::reset () [inline]

Resets the distribution state. fresh start, clean slate, main character reinvention energy 🌈


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

Inserts a chi_squared_distribution random number distribution __x into the output stream __os.

Parameters

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

Returns

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

lowkey important: if things go sideways you don't get a value, you get the stream sitting in an error state. so check it, bestie 😭
template<typename _RealType = double> bool operator== (const
    chi_squared_distribution< _RealType > & __d1, const
    chi_squared_distribution< _RealType > & __d2) [friend]

Return true if two Chi-squared distributions have the same parameters and the sequences that would be generated are equal. twin flames fr fr 🫢

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

Extracts a chi_squared_distribution random number distribution __x from the input stream __is.

Parameters

  • __is β€” an input stream.
  • __x β€” a chi_squared_distribution random number generator engine.

Returns

The input stream with __x extracted or in an error state.

same deal as the output side: error state is always a possibility. it's giving "read the stream state, don't assume" πŸ’€

πŸ“ Author πŸ“

Generated automatically by Doxygen for libstdc++ from the source code. not a human, not a poet, just Doxygen doing her thing πŸ’œ


and that's the whole page, periodt ✨ this one came to you courtesy of libstdc++ (that's the footer, she's the source/version, and she's iconic), auto-generated from the source code by Doxygen for the std::chi_s...RealType >(3) page β€” mwah, take care of her, she's your bestie now πŸ‘‘πŸ’–

πŸ“¦ 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
  • 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