std::subtra...carry_engine(3)
π NAME π
std::subtract_with_carry_engine::subtract_with_carry_engine β bestie, this is the constructor page, and you're reading it in the C++ Standard Libary manual under the name std::subtra...carry_engine(3). iconic. π
π Synopsis π
subtract_with_carry_engine() : subtract_with_carry_engine(0u) {} (1) (since C++11)
explicit subtract_with_carry_engine( result_type value ); (2) (since C++11)
template< class SeedSeq >
explicit subtract_with_carry_engine( SeedSeq& seq ); (3) (since C++11)
subtract_with_carry_engine( const subtract_with_carry_engine& other ); (4) (since C++11)
(implicitly declared)
Constructs the pseudo-random number engine. π«Ά
- The default constructor.
- Seed value constructor. Constructs the engine with a seed value
value. The sequenceXof the engine's initial state is determined as follows:- Constructs a
std::linear_congruential_engine<std::uint_least32_t, 40014u, 0u, 2147483563u>objectewith argumentvalue == 0u ? default_seed : value. - Let
nbestd::size_t(w / 32) + 1. - Sets the values of
X_{-r}, ...,X_{-1}, in that order. Each valueX_iis set as specified below:- Successively calls
eforntimes, the return values are denoted asz_0...z_{n-1}. - Sets
X_ito\((\sum^{n-1}_{j=0} z_j \cdot 2^{32j}) \mod m\). IfX_{-1}is0, sets the carry valuecof the engine's initial state to1. Otherwise, setscto0.
- Successively calls
- Constructs a
- Seed sequence constructor. Constructs the engine with a seed sequence
seq. Givenstd::size_t(w / 32) + 1ask, the sequenceXof the engine's initial state is determined as follows:- Creates an invented array object
aof lengthr * k. - Calls
seq.generate(a + 0, a + r * k). - For each integer
iin[-r, -1], setsX_{i}to\((\sum^{k-1}_{j=0} a_{k(i+r)+j} \cdot 2^{32j}) \mod m\). IfX_{-1}is0, sets the carry valuecof the engine's initial state to1. Otherwise, setscto0. This overload participates in overload resolution only ifSeedSeqmeets the requirements ofSeedSequence.
- Creates an invented array object
- The copy constructor. Upon construction,
*this == otheristrue.
πΈ 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.
π₯ Complexity π₯
1,2)β(std::size_t(w / 32) + 1) * rinvocations ofe.3)β Same as the complexity of theseq.generatecall.4)βO(r).
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
LWG 3809β applied to:C++11; behavior as published: "ecould not be constructed ifresult_typeisstd::uint16_t"; correct behavior: "ecan be constructed in this case".P0935R0β applied to:C++11; behavior as published: "the default constructor wasexplicit"; correct behavior: "made implicit".
π¦ See also π¦
seedβ sets the current state of the engine β(C++11)(public member function).
okay that's the whole page, bestie π«Ά β source/version: http://cppreference.com; date: 2024.06.10; footer manual name: std::subtra...carry_engine(3). slay and goodbye π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms