subtract_with_carry_engine Class

通过减去生成一个随机顺序与具有算法。

template<class UIntType,
    int W, int S, int R>
    class subtract_with_carry_engine {
public:
    typedef UIntType result_type;
    static const int word_size = W;
    static const int short_lag = S;
    static const int long_lag = R;
    static const UIntType default_seed = 19780503U;
    explicit subtract_with_carry_engine(UIntType x0 = default_seed);
    explicit subtract_with_carry_engine(seed_seq& seq);
    void seed(UIntType x0 = default_seed);
    void seed(seed_seq& seq);
    static const result_type min();
    static const result_type max();
    result_type operator()();
    void discard(unsigned long long count)();
    };

参数

  • UIntType
    整数结果类型。

  • W
    M引擎参数。

  • S
    引擎的参数。

  • R
    R引擎参数。

备注

使用重复关系 x(i) = (x(i - R) - x(i - S) - cy(i - 1)) mod M,生成一个用户指定的无符号整型值,cy(i) 具有值 1 的模板选件类描述 简单的引擎,如果 x(i - S) - x(i - R) - cy(i - 1) < 0、否则 0和 M 具有值 2W。(请注意模板参数此处 W 替换 subtract_with_carry的模板参数 M。)引擎处理状态是带有指示符以及 R 值。这些值由返回的最后 R 值,如果 operator() 调用至少 R 时,否则返回的 N 值和一个种子的最后一 R - N 值。

模板参数 UIntType 必须足够大表示值到 M - 1。模板参数 S 和 R 的值大于0和 S 必须小于 R输入到。

要求

标头: <random>

命名空间: std

请参见

参考

<random>

subtract_with_carry_engine::discard

subtract_with_carry_engine::operator()

subtract_with_carry_engine::seed

subtract_with_carry_engine::subtract_with_carry_engine