Scroll to navigation

std::philox_engine< _UIntType, __w, __n, __r, __consts >(3cxx) std::philox_engine< _UIntType, __w, __n, __r, __consts >(3cxx)

NAME

std::philox_engine< _UIntType, __w, __n, __r, __consts > - A discrete pseudorandom number generator with weak cryptographic properties.

SYNOPSIS

#include <random>

Public Types


using result_type

Public Member Functions


template<typename _Sseq>
requires __is_seed_seq<_Sseq>philox_engine (_Sseq &__q)"
seed sequence constructor for philox_engine philox_engine (result_type __value)
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>
requires __is_seed_seq<_Sseq>void seed (_Sseq &__q)"
seeds philox_engine by seed sequence void seed (result_type __value=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.

This algorithm was designed to be used for highly parallel random number generation, and is capable of immensely long periods. It provides "Crush-resistance", denoting an ability to pass the TestU01 Suite's "Big Crush" test, demonstrating significant apparent entropy.

It is not intended for cryptographic use and should not be used for such, despite being based on cryptographic primitives.

The typedefs philox4x32 and philox4x64 are provided as suitable defaults for most use cases, providing high-quality random numbers with reasonable performance.

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

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

Constructor & Destructor Documentation

template<typename _UIntType, size_t __w, size_t __n, size_t __r, _UIntType... __consts> template<typename _Sseq>

requires __is_seed_seq<_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

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

Parameters

__z number of iterations to discard

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().

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.

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

Returns

return_type

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().

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

Friends And Related Symbol Documentation

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

Parameters

__os An output stream.
__x A philox_engine object reference

Returns

the state of the Philox Engine in __os

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

Returns

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

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.

libstdc++