由浮点生成一个随机顺序减去与具有算法。保留为TR1兼容性。请改用 subtract_with_carry_engine Class。
template<class RealType,
int W, int S, int R>
class subtract_with_carry_01 {
public:
typedef RealType result_type;
static const int word_size = W;
static const int short_lag = S;
static const int long_lag = R;
subtract_with_carry_01();
explicit subtract_with_carry_01(unsigned long x0);
template<class Gen>
subtract_with_carry_01(Gen& gen);
subtract_with_carry_01(const subtract_with_carry_01& right);
subtract_with_carry_01(subtract_with_carry_01& right);
void seed(unsigned long x0 = 19780503UL);
template<class Gen>
void seed(Gen& gen);
result_type min() const;
result_type max() const;
result_type operator()();
};
参数
RealType
浮点结果类型。W
W引擎参数。S
引擎的参数。R
R引擎参数。
备注
模板选件类描述使用重复关系 x(i) = (x(i - R) - x(i - S) - cy(i - 1)) mod 1,生成一个用户指定的浮点类型的值,cy(i) 具有值 2-W,如果 x(i - S) - x(i - R) - cy(i - 1) < 0,否则 0的简单引擎。引擎处理状态是返回的最后 R 值,如果 operator() 调用至少 R 时,否则返回的 M 值和最后 R - 种子的M 值。
模板参数 RealType 必须足够大表示与 W 部分位的值。模板参数 S 和 R 的值大于0和 S 必须小于 R输入到。
要求
标头: <random>
命名空间: std