Freigeben über


subtract_with_carry_engine::seed

Seeds the engine.

void seed(UIntType x0 = default_seed);
void seed(seed_seq& seq);

Parameters

  • x0
    The seed value.

  • seq
    The object of type seed_seq that supplies the randomized seed.

Remarks

Precondition: 0 < x0

The first seed function effectively constructs the engine gen:

    linear_congruential_engine<UIntType, 40014, 0, 2147483563>
    gen(x0 == 0 ? default_seed: x0);

It then sets the R historical values beginning with h[0] to the values produced by calling gen().

The second seed function sets these historical values as follows:

  • k is the number of unsigned long integers needed to supply all the bits in a UIntType integer (at least 1).

  • a is an array of R * k elements of type UIntType.

  • a is initialized by calling seq.generate(&a[0], &a[R * k]).

  • Each h[i] is composed by packing the k elements beginning at a[i * k], which supplies the lowest-order bits.

  • Each h[i] is reduced modulo M.

In either case, the stored carry is h[R - 1] == 0.

Requirements

Header: <random>

Namespace: std

See Also

Reference

<random>

subtract_with_carry_engine Class

Other Resources

<random> Members