std::philox_engine<UIntType,w,n,r,consts>::philox_engine
From cppreference.com
< cpp | numeric | random | philox engine
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Numerics library
Mathematical special functions (C++17)
Mathematical constants (C++20)
Basic linear algebra algorithms (C++26)
Data-parallel types (SIMD) (C++26)
Floating-point environment (C++11)
Bit manipulation (C++20)
Saturation arithmetic (C++26)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
Pseudo-random number generation
(C++20)
(C++11)
(C++11)
(C++11)
(C++26)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++26)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
std::philox_engine
Member functions
philox_engine::philox_engine
Generation
Characteristics
Non-member functions
(C++26)
(C++26)(C++26)
philox_engine() : philox_engine(default_seed) {}
(1)
(since C++26)
explicit philox_engine( result_type value );
(2)
(since C++26)
template< class SeedSeq >
explicit philox_engine( SeedSeq& seq );
(3)
(since C++26)
explicit philox_engine( SeedSeq& seq );
philox_engine( const philox_engine& other );
(4)
(since C++26) (implicitly declared)
Constructs the pseudo-random number engine.
1) The default constructor.
- If the default-constructed engine is of type
std::philox4x32
, the 10000th consecutive invocation of it produces the value 1955073260. - If the default-constructed engine is of type
std::philox4x64
, the 10000th consecutive invocation of it produces the value 3409172418970261260.
2) Constructs the engine with a seed value value. The engine's initial state is determined as follows:[1]
- All elements of the sequence X are set to zero.
- The first element of the sequence K is set to \(\scriptsize value \mod 2^w \)value mod 2w
, the remaining elements are set to zero. - The value of j is set to n - 1.
3) Constructs the engine with a seed sequence seq. The engine's initial state is determined as follows:[1]
- All elements of the sequence X are set to zero.
- Given (w - 1) / 32 + 1 as p, the elements of the sequence K are set by the following steps:
- Creates an invented array object a of length n / 2 * p.
- Calls seq.generate(a + 0, a + n / 2 * p).
- For each integer k in
[
0,
n / 2)
, sets \(\scriptsize K_k \)Kk to \(\scriptsize (\sum^{p-1}_{i=0} a_{k \cdot p+i} \cdot 2^{32i}) \mod 2^w \)(∑p-1
i=0 ak·p+i·232i
) mod 2w
.
- The value of j is set to n - 1.
This overload participates in overload resolution only if
SeedSeq
meets the requirements of SeedSequence.4) The copy constructor. Upon construction, *this == other is true.
- ↑ 1.0 1.1 The buffer Y is intentionally not being set. As j is being set to n - 1, the next state transition always generates new random values and stores them in Y.
Contents
[edit] Parameters
value
-
seed value to use in the initialization of the internal state
seq
-
seed sequence to use in the initialization of the internal state
[edit] Complexity
1,2) Constant.
3) Same as the complexity of the
seq.generate
call.4) Constant.