STD::SHUFFLE_ORDER_ENGINE(3)
π std::shuffle_order_engine< _RandomNumberEngine, __k > π
okay so bestie, welcome to section 3 of the library functions manual β this one's all about std::shuffle_order_engine, and yes it lives in libstdc++ (that's the GNU C++ standard library, the one that comes with gcc, iykyk). it's giving β¨ chaotic-but-organized random number energy β¨ and honestly? obsessed.
π NAME π
std::shuffle_order_engine< _RandomNumberEngine, __k > β produces random numbers by reordering random numbers from some base engine.
like, it's not making new randomness, it's just remixing the randomness it already has. a DJ, basically. π
πΈ SYNOPSIS πΈ
#include <random>
π¦ Public Types
template<typename _Sseq> using _If_seed_seqβ a lil helper alias, it's the SFINAE gatekeeper for seed-sequence constructors andseed()overloads.typedef _RandomNumberEngine::result_type result_typeβ the type of the numbers this whole thing spits out, straight borrowed from the base engine.
π Public Member Functions
shuffle_order_engine ()β constructs a defaultshuffle_order_engineengine.shuffle_order_engine (_RandomNumberEngine &&__rng)β move constructs ashuffle_order_engineengine.template<typename _Sseq, typename = _If_seed_seq<_Sseq>> shuffle_order_engine (_Sseq &__q)β generator construct ashuffle_order_engineengine.shuffle_order_engine (const _RandomNumberEngine &__rng)β copy constructs ashuffle_order_engineengine.shuffle_order_engine (result_type __s)β seed constructs ashuffle_order_engineengine.const _RandomNumberEngine & base () const noexceptβ hands you the underlying engine object (const ref, no throws, no drama).void discard (unsigned long long __z)β yeet a whole sequence of random numbers into the void.result_type operator() ()β gets the next value in the generated random number sequence.void seed ()β reseeds theshuffle_order_engineobject with the default seed for the underlying base class generator engine.template<typename _Sseq> _If_seed_seq< _Sseq > seed (_Sseq &__q)β reseeds theshuffle_order_engineobject with the given seed sequence.void seed (result_type __s)β reseeds theshuffle_order_engineobject with the default seed for the underlying base class generator engine. (yes bestie, that's literally what the original says for this one β no, it doesn't take__sinto account in the description, don't come for me, I'm just the messenger π)
π Static Public Member Functions
static constexpr result_type max ()β the maximum value in the generated random number range.static constexpr result_type min ()β the minimum value in the generated random number range.
π Static Public Attributes
static constexpr size_t table_sizeβ the size of the lil table, as a static constexpr. iconic.
π Friends
template<typename _RandomNumberEngine1, size_t __k1, typename _CharT, typename _Traits> std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::shuffle_order_engine< _RandomNumberEngine1, __k1 > &__x)β inserts the current state of ashuffle_order_enginerandom number generator engine__xinto the output stream__os.bool operator== (const shuffle_order_engine &__lhs, const shuffle_order_engine &__rhs)β compares twoshuffle_order_enginerandom number generator objects of the same type for equality.template<typename _RandomNumberEngine1, size_t __k1, typename _CharT, typename _Traits> std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, std::shuffle_order_engine< _RandomNumberEngine1, __k1 > &__x)β extracts the current state of a% subtract_with_carry_enginerandom number generator engine__xfrom the input stream__is.
β¨ Detailed Description β¨
template<typename _RandomNumberEngine, size_t __k>
class std::shuffle_order_engine< _RandomNumberEngine, __k >
produces random numbers by reordering random numbers from some base engine.
the values from the base engine are stored in a sequence of size __k and shuffled by an algorithm that depends on those values.
Since: C++11 π«Ά
π§ Member Typedef Documentation π§
template<typename _RandomNumberEngine, size_t __k>
typedef _RandomNumberEngine::result_type std::shuffle_order_engine< _RandomNumberEngine, __k >::result_type
the type of the generated random value. that's it, that's the whole vibe. β
π Constructor & Destructor Documentation π
shuffle_order_engine () [inline]
template<typename _RandomNumberEngine, size_t __k>
std::shuffle_order_engine< _RandomNumberEngine, __k >::shuffle_order_engine () [inline]
constructs a default shuffle_order_engine engine. the underlying engine is default constructed as well, so it's giving "no thoughts, head empty, still random" πΈ
shuffle_order_engine (const _RandomNumberEngine & __rng) [inline], [explicit]
template<typename _RandomNumberEngine, size_t __k>
std::shuffle_order_engine< _RandomNumberEngine, __k >::shuffle_order_engine (const _RandomNumberEngine & __rng) [inline], [explicit]
copy constructs a shuffle_order_engine engine. copies an existing base class random number generator. it's a glow-up-by-duplication moment π
Parameters
__rngβ an existing (base class) engine object.
shuffle_order_engine (_RandomNumberEngine && __rng) [inline], [explicit]
template<typename _RandomNumberEngine, size_t __k>
std::shuffle_order_engine< _RandomNumberEngine, __k >::shuffle_order_engine (_RandomNumberEngine && __rng) [inline], [explicit]
move constructs a shuffle_order_engine engine. copies an existing base class random number generator. (yes, the description literally says "copies" for the move constructor β that's the original's words, not mine, bestie, I promise π)
Parameters
__rngβ an existing (base class) engine object.
shuffle_order_engine (result_type __s) [inline], [explicit]
template<typename _RandomNumberEngine, size_t __k>
std::shuffle_order_engine< _RandomNumberEngine, __k >::shuffle_order_engine (result_type __s) [inline], [explicit]
seed constructs a shuffle_order_engine engine. constructs the underlying generator engine seeded with __s. give it a seed, it gives you a whole personality π
Parameters
__sβ a seed value for the base class engine.
shuffle_order_engine (_Sseq & __q) [inline], [explicit]
template<typename _RandomNumberEngine, size_t __k>
template<typename _Sseq, typename = _If_seed_seq<_Sseq>>
std::shuffle_order_engine< _RandomNumberEngine, __k >::shuffle_order_engine (_Sseq & __q) [inline], [explicit]
generator construct a shuffle_order_engine engine. (grammar? never met her. the original said it like that and I'm keeping it fr fr.)
Parameters
__qβ a seed sequence.
π₯ Member Function Documentation π₯
base () const [inline], [noexcept]
template<typename _RandomNumberEngine, size_t __k>
const _RandomNumberEngine & std::shuffle_order_engine< _RandomNumberEngine, __k >::base () const [inline], [noexcept]
gets a const reference to the underlying generator engine object. peek behind the curtain, no touching π
discard (unsigned long long __z) [inline]
template<typename _RandomNumberEngine, size_t __k>
void std::shuffle_order_engine< _RandomNumberEngine, __k >::discard (unsigned long long __z) [inline]
discard a sequence of random numbers. gone. not seen. blocked. π
max () [inline], [static], [constexpr]
template<typename _RandomNumberEngine, size_t __k>
constexpr result_type std::shuffle_order_engine< _RandomNumberEngine, __k >::max () [inline], [static], [constexpr]
gets the maximum value in the generated random number range. the ceiling. the limit. the top of the vibe check β
min () [inline], [static], [constexpr]
template<typename _RandomNumberEngine, size_t __k>
constexpr result_type std::shuffle_order_engine< _RandomNumberEngine, __k >::min () [inline], [static], [constexpr]
gets the minimum value in the generated random number range. the floor, the baseline, the bare minimum (and we accept it) πΈ
operator() ()
template<typename _RandomNumberEngine, size_t __k>
shuffle_order_engine< _RandomNumberEngine, __k >::result_type
std::shuffle_order_engine< _RandomNumberEngine, __k >::operator() ()
gets the next value in the generated random number sequence. this is the main character moment β¨
References std::max(), and std::min().
seed () [inline]
template<typename _RandomNumberEngine, size_t __k>
void std::shuffle_order_engine< _RandomNumberEngine, __k >::seed () [inline]
reseeds the shuffle_order_engine object with the default seed for the underlying base class generator engine. factory reset but make it random π¦
seed (_Sseq & __q) [inline]
template<typename _RandomNumberEngine, size_t __k>
template<typename _Sseq>
_If_seed_seq< _Sseq > std::shuffle_order_engine< _RandomNumberEngine, __k >::seed (_Sseq & __q) [inline]
reseeds the shuffle_order_engine object with the given seed sequence.
Parameters
__qβ a seed generator function.
seed (result_type __s) [inline]
template<typename _RandomNumberEngine, size_t __k>
void std::shuffle_order_engine< _RandomNumberEngine, __k >::seed (result_type __s) [inline]
reseeds the shuffle_order_engine object with the default seed for the underlying base class generator engine. (again β that's the original's description for this overload, __s and all. not me being shady, that's just what it says π)
π Friends And Related Symbol Documentation π
operator<< [friend]
template<typename _RandomNumberEngine, size_t __k>
template<typename _RandomNumberEngine1, size_t __k1, typename _CharT, typename _Traits>
std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > & __os, const std::shuffle_order_engine< _RandomNumberEngine1, __k1 > & __x) [friend]
inserts the current state of a shuffle_order_engine random number generator engine __x into the output stream __os. it's a state-dump, it's a screenshot, it's a "saving my progress" moment πΈ
Parameters
__osβ an output stream.__xβ ashuffle_order_enginerandom number generator engine.
Returns
the output stream with the state of __x inserted or in an error state.
operator== [friend]
template<typename _RandomNumberEngine, size_t __k>
bool operator== (const shuffle_order_engine< _RandomNumberEngine, __k > & __lhs, const shuffle_order_engine< _RandomNumberEngine, __k > & __rhs) [friend]
compares two shuffle_order_engine random number generator objects of the same type for equality.
Parameters
__lhsβ ashuffle_order_enginerandom number generator object.__rhsβ anothershuffle_order_enginerandom number generator object.
Returns
true if the infinite sequences of generated values would be equal, false otherwise. infinite sequences bestie, they're comparing infinities, we stan a thorough queen π
operator>> [friend]
template<typename _RandomNumberEngine, size_t __k>
template<typename _RandomNumberEngine1, size_t __k1, typename _CharT, typename _Traits>
std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > & __is, std::shuffle_order_engine< _RandomNumberEngine1, __k1 > & __x) [friend]
extracts the current state of a % subtract_with_carry_engine random number generator engine __x from the input stream __is. (the % is literally in the original, it's a Doxygen-ism, don't @ me π«Ά)
Parameters
__isβ an input stream.__xβ ashuffle_order_enginerandom number generator engine.
Returns
the input stream with the state of __x extracted or in an error state.
π Author π
generated automatically by Doxygen for libstdc++ from the source code. like, no human wrote this, a robot did, and honestly? it ate. π
okay that's the whole page bestie!! π this was std::shuffle_order_engine< _RandomNumberEngine, __k >(3), part of the Library Functions Manual for libstdc++, and we are SO done. go forth and shuffle, no cap, periodt. β¨π¦π
π¦ 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 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