std::subtract_with_carry_engine<UIntType,w,s,r>::subtract_with_carry_engine

Constructs the pseudo-random number engine.

# Declarations

subtract_with_carry_engine() : subtract_with_carry_engine(0u) {}

(since C++11)

explicit subtract_with_carry_engine( result_type value );

(since C++11)

template< class SeedSeq >
explicit subtract_with_carry_engine( SeedSeq& seq );

(since C++11)

subtract_with_carry_engine( const subtract_with_carry_engine& other );

(since C++11) (implicitly declared)

# Parameters

# Example

#include <cassert>
#include <random>
 
int main()
{
    std::ranlux24_base gen24; // overload (1)
    std::ranlux48_base gen48; // overload (1)
    gen24.discard(10000 - 1);
    gen48.discard(10000 - 1);
    assert(gen24() == 7'937'952);
    assert(gen48() == 61'839'128'582'725);
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2181C++11overload (3) would not throw even if the seq.generate call throwspropagates the exception
LWG 3809C++11e could not be constructed if result_type is std::uint16_tcan be constructed in this case
LWG 4014C++11the resolution of LWG issue 3809 caused the initial seedof the intermediate std::linear_congruential_engineto have a different type from the engine’s result_typetruncates andconverts value
P0935R0C++11the default constructor was explicitmade implicit

# See also