STD::PHILOX_ENGINE(3)

πŸ“¦
version 16.2.1+r23+gd564253eb6c8 Β· 3 versions
, in arch rolling, fedora 44

🌸 std::philox_engine β€” the manual page πŸ’…

okay bestie, welcome to the Library Functions Manual, page for std::philox_engine< _UIntType, __w, __n, __r, __consts > πŸ¦‹ (yes the header truncates it to std::philo...__consts >(3), she's shy, it's fine).


✨ NAME ✨

std::philox_engine< _UIntType, __w, __n, __r, __consts > β€” a discrete pseudorandom number generator with weak cryptographic properties. πŸ”₯ (yes, "weak" is doing a lot of work there, we'll get to it, i promise)


πŸ’– SYNOPSIS πŸ’–

#include <random>

πŸ‘‘ Public Types

  • using result_type β€” the type she spits out. iconic, no notes.

🧚 Public Member Functions

  • template<typename _Sseq> philox_engine (_Sseq &__q) β€” seed sequence constructor for philox_engine
  • philox_engine (result_type __value) β€” takes a value, does the thing
  • void discard (unsigned long long __z) β€” discards __z numbers
  • result_type operator() () β€” outputs a single w-bit number and handles state advancement
  • template<typename _Sseq> with requires __is_seed_seq<_Sseq> β€” void seed (_Sseq &__q) β€” seeds philox_engine by seed sequence
  • void seed (result_type __value=default_seed) β€” seeds it with a value, defaults to default_seed
  • void set_counter (const array< result_type, __n > &__counter) β€” sets the internal counter cleartext πŸ’€

⭐ Static Public Member Functions

  • static constexpr result_type max () β€” the maximum value that this engine can return.
  • static constexpr result_type min () β€” the minimum value that this engine can return.

🌈 Static Public Attributes

  • static constexpr result_type default_seed
  • static constexpr array< result_type, __n/2 > multipliers
  • static constexpr array< result_type, __n/2 > round_consts
  • static constexpr size_t round_count
  • static constexpr size_t word_count
  • static constexpr size_t word_size

🫢 Friends

  • template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & operator<< (basic_ostream< _CharT, _Traits > &__os, const philox_engine &__x) β€” outputs the state of the generator
  • bool operator== (const philox_engine &, const philox_engine &)=default β€” compares two philox_engine objects
  • template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & operator>> (basic_istream< _CharT, _Traits > &__is, philox_engine &__x) β€” takes input to set the state of the philox_engine object

🌸 Detailed Description 🌸

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts>
    class std::philox_engine< _UIntType, __w, __n, __r, __consts >

A discrete pseudorandom number generator with weak cryptographic properties.

so like, this algorithm was designed to be used for highly parallel random number generation, and she is capable of immensely long periods. literally endless vibes. ✨

she provides "Crush-resistance", which denotes an ability to pass the TestU01 Suite's "Big Crush" test, demonstrating significant apparent entropy. she ate that test suite and left no crumbs. πŸ‘‘

ok but for real: it is not intended for cryptographic use and should not be used for such, despite being based on cryptographic primitives. do not do it. i'm serious. 🚨

the typedefs philox4x32 and philox4x64 are provided as suitable defaults for most use cases, giving high-quality random numbers with reasonable performance. use those, bestie, they're the moment. πŸ’…

this algorithm was created by John Salmon, Mark Moraes, Ron Dror, and David Shaw as a product of D.E. Shaw Research. legends only. 🌟

πŸŽ€ Template Parameters

  • __w β€” Word size
  • __n β€” Buffer size
  • __r β€” Rounds
  • __consts β€” Multiplication and round constant pack, ordered as M_{0}, C_{0}, M_{1}, C_{1}, ... , M_{N/2-1}, C_{N/2-1}

πŸ¦‹ Since

C++26 β€” she's new here but she's already the main character.


🧚 Constructor & Destructor Documentation 🧚

philox_engine (_Sseq & __q) β€” seed sequence constructor

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> template<typename _Sseq>
    std::philox_engine< _UIntType, __w, __n, __r, __consts >::
    philox_engine (_Sseq & __q) [inline], [explicit]

seed sequence constructor for philox_engine 🌱

Parameters

  • __q β€” the seed sequence

πŸ’œ Member Function Documentation πŸ’œ

discard (unsigned long long __z)

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> void
    std::philox_engine< _UIntType, __w, __n, __r, __consts >::
    discard (unsigned long long __z) [inline]

discards __z numbers πŸ—‘οΈ just straight up skipping them, no cap.

Parameters

  • __z β€” number of iterations to discard

max ()

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> constexpr result_type
    std::philox_engine< _UIntType, __w, __n, __r, __consts >::
    max () [inline], [static], [constexpr]

the maximum value that this engine can return. πŸ”οΈ

Referenced by std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>, and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::set_counter().

min ()

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> constexpr result_type
    std::philox_engine< _UIntType, __w, __n, __r, __consts >::
    min () [inline], [static], [constexpr]

the minimum value that this engine can return. 🐜

operator() ()

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> result_type
    std::philox_engine< _UIntType, __w, __n, __r, __consts >::
    operator() () [inline]

outputs a single w-bit number and handles state advancement. the whole glow-up happens right here. ✨

Returns

return_type

seed (_Sseq & __q)

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts>
    requires __is_seed_seq<_Sseq>template<typename _Sseq>
    requires __is_seed_seq<_Sseq>void
    std::philox_engine< _UIntType, __w, __n, __r, __consts >::
    seed (_Sseq & __q)

seeds philox_engine by seed sequence 🌰

Parameters

  • __q β€” the seed sequence

References std::max().

set_counter (const array< result_type, __n > & __counter)

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> void
    std::philox_engine< _UIntType, __w, __n, __r, __consts >::
    set_counter (const array< result_type, __n > & __counter) [inline]

sets the internal counter "cleartext" πŸ”“

Parameters

  • __counter β€” std::array of len N

operator<<

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> template<typename _CharT, typename _Traits>
    basic_ostream< _CharT, _Traits > &
    operator<< (basic_ostream< _CharT, _Traits > & __os,
    const philox_engine< _UIntType, __w, __n, __r, __consts > & __x) [friend]

outputs the state of the generator πŸ“€ spill the tea, bestie.

Parameters

  • __os β€” An output stream.
  • __x β€” A philox_engine object reference

Returns

the state of the Philox Engine in __os

operator==

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> bool
    operator== (const philox_engine< _UIntType, __w, __n, __r, __consts > & ,
    const philox_engine< _UIntType, __w, __n, __r, __consts > & ) [friend]

compares two philox_engine objects πŸ‘― are they the same girl? let's find out.

Returns

true if the objects will produce an identical stream, false otherwise

operator>>

template<typename _UIntType, size_t __w, size_t __n, size_t __r,
    _UIntType... __consts> template<typename _CharT, typename _Traits>
    basic_istream< _CharT, _Traits > &
    operator>> (basic_istream< _CharT, _Traits > & __is,
    philox_engine< _UIntType, __w, __n, __r, __consts > & __x) [friend]

takes input to set the state of the philox_engine object πŸ“₯

Parameters

  • __is β€” An input stream.
  • __x β€” A philox_engine object reference

Returns

philox_engine object is set with values from instream


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. (not a human, just a little robot doing her best 🫢)


okay that's the whole page!! πŸ’– this manual was served up by libstdc++ and this is the std::philo...__consts >(3) page, so if you were looking for the rest of the name, she got truncated by the terminal and honestly? she's thriving. bye bestie, go generate some numbers that are not for cryptography πŸŒΈβœ¨πŸŽ€

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