STD::PHILOX_ENGINE(3)
πΈ 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 forphilox_enginephilox_engine (result_type __value)β takes a value, does the thingvoid discard (unsigned long long __z)β discards__znumbersresult_type operator() ()β outputs a single w-bit number and handles state advancementtemplate<typename _Sseq>withrequires __is_seed_seq<_Sseq>βvoid seed (_Sseq &__q)β seedsphilox_engineby seed sequencevoid seed (result_type __value=default_seed)β seeds it with a value, defaults todefault_seedvoid 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_seedstatic constexpr array< result_type, __n/2 > multipliersstatic constexpr array< result_type, __n/2 > round_constsstatic constexpr size_t round_countstatic constexpr size_t word_countstatic 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 generatorbool operator== (const philox_engine &, const philox_engine &)=defaultβ compares twophilox_engineobjectstemplate<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & operator>> (basic_istream< _CharT, _Traits > &__is, philox_engine &__x)β takes input to set the state of thephilox_engineobject
πΈ 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 asM_{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::arrayof len N
π Friends And Related Symbol Documentation π
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β Aphilox_engineobject 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β Aphilox_engineobject 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