#
A philox_engine random number engine produces unsigned integer random numbers in the interval [0, m), where
The state of a philox_engine object consists of a sequence X of n unsigned integer values of width w, a sequence K of
2
#
The generation algorithm returns
The state transition is performed as if by the following algorithm: i = i + 1 if (i == n) { Y = Philox(K, X) / see below Z = Z + 1 i = 0 }
The Philox function maps the length-
Philox applies an r-round substitution-permutation network to the values in X.
A single round of the generation algorithm performs the following steps:
  • The output sequence
  • The following computations are applied to the elements of the V sequence:
After r applications of the single-round function, Philox returns the sequence
namespace std { template<class UIntType, size_t w, size_t n, size_t r, UIntType.. consts> class philox_engine { static constexpr size_t array-size = n / 2; / exposition only public: / types using result_type = UIntType; / engine characteristics static constexpr size_t word_size = w; static constexpr size_t word_count = n; static constexpr size_t round_count = r; static constexpr array<result_type, array-size> multipliers; static constexpr array<result_type, array-size> round_consts; static constexpr result_type min() { return 0; } static constexpr result_type max() { return m - 1; } static constexpr result_type default_seed = 20111115u; / constructors and seeding functions philox_engine() : philox_engine(default_seed) {} explicit philox_engine(result_type value); template<class Sseq> explicit philox_engine(Sseq& q); void seed(result_type value = default_seed); template<class Sseq> void seed(Sseq& q); void set_counter(const array<result_type, n>& counter); / equality operators friend bool operator=(const philox_engine& x, const philox_engine& y); / generating functions result_type operator()(); void discard(unsigned long z); / inserters and extractors template<class charT, class traits> friend basic_ostream<charT, traits>& operator<(basic_ostream<charT, traits>& os, const philox_engine& x); / hosted template<class charT, class traits> friend basic_istream<charT, traits>& operator>(basic_istream<charT, traits>& is, philox_engine& x); / hosted }; }
The template parameter pack consts represents the
The textual representation consists of the values of
[Note 2: 
The stream extraction operator can reconstruct Y from K and X, as needed.
— end note]
explicit philox_engine(result_type value);
Effects: Sets the
All elements of sequences X and K (except
The value of i is set to
template<class Sseq> explicit philox_engine(Sseq& q);
Effects: With
All elements of sequence X are set to 0.
The value of i is set to
void set_counter(const array<result_type, n>& c);
Effects: For
The value of i is set to
[Note 3: 
The counter is the value Z introduced at the beginning of this subclause.
— end note]

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