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 and seed() 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 default shuffle_order_engine engine.
  • shuffle_order_engine (_RandomNumberEngine &&__rng) β€” move constructs a shuffle_order_engine engine.
  • template<typename _Sseq, typename = _If_seed_seq<_Sseq>> shuffle_order_engine (_Sseq &__q) β€” generator construct a shuffle_order_engine engine.
  • shuffle_order_engine (const _RandomNumberEngine &__rng) β€” copy constructs a shuffle_order_engine engine.
  • shuffle_order_engine (result_type __s) β€” seed constructs a shuffle_order_engine engine.
  • 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 the shuffle_order_engine object with the default seed for the underlying base class generator engine.
  • template<typename _Sseq> _If_seed_seq< _Sseq > seed (_Sseq &__q) β€” reseeds the shuffle_order_engine object with the given seed sequence.
  • void seed (result_type __s) β€” reseeds the shuffle_order_engine object 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 __s into 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 a shuffle_order_engine random number generator engine __x into the output stream __os.
  • bool operator== (const shuffle_order_engine &__lhs, const shuffle_order_engine &__rhs) β€” compares two shuffle_order_engine random 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_engine random number generator engine __x from 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 😭)


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 β€” a shuffle_order_engine random 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 β€” a shuffle_order_engine random number generator object.
  • __rhs β€” another shuffle_order_engine random 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 β€” a shuffle_order_engine random 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