#
A shuffle_order_engine random number engine adaptor produces the same random numbers that are produced by some base engine e, but delivers them in a different sequence.
The state x
The size of the state is the size of e's state plus
2
#
The transition algorithm permutes the values produced by e.
The state transition is performed as follows:
  • Calculate an integer
  • Set Y to
The generation algorithm yields the last value of Y produced while advancing e's state as described above.
namespace std { template<class Engine, size_t k> class shuffle_order_engine { public: / types using result_type = Engine::result_type; / engine characteristics static constexpr size_t table_size = k; static constexpr result_type min() { return Engine::min(); } static constexpr result_type max() { return Engine::max(); } / constructors and seeding functions shuffle_order_engine(); explicit shuffle_order_engine(const Engine& e); explicit shuffle_order_engine(Engine&& e); explicit shuffle_order_engine(result_type s); template<class Sseq> explicit shuffle_order_engine(Sseq& q); void seed(); void seed(result_type s); template<class Sseq> void seed(Sseq& q); / equality operators friend bool operator=(const shuffle_order_engine& x, const shuffle_order_engine& y); / generating functions result_type operator()(); void discard(unsigned long z); / property functions const Engine& base() const noexcept { return e; } / inserters and extractors template<class charT, class traits> friend basic_ostream<charT, traits>& operator<(basic_ostream<charT, traits>& os, const shuffle_order_engine& x); template<class charT, class traits> friend basic_istream<charT, traits>& operator>(basic_istream<charT, traits>& is, shuffle_order_engine& x); private: Engine e; / exposition only result_type V[k]; / exposition only result_type Y; / exposition only }; }
The following relation shall hold: 0 < k.
The textual representation consists of the textual representation of e, followed by the k values of V, followed by the value of Y.
In addition to its behavior pursuant to subclause [rand.req.adapt], each constructor that is not a copy constructor initializes V[0], …, V[k - 1] and Y, in that order, with values returned by successive invocations of e().

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant