Condividi tramite


linear_congruential_engine::seed

Seeds the engine.

void seed(result_type 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

The first seed function sets the stored value stored_value to 1 if C mod M == 0 and x0 mod M == 0, otherwise it sets the stored value to x0 mod M. The second seed function calls seed(x), where x is determined 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 3 + k elements of type UIntType.

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

  • x is composed by packing the k elements beginning at a[3], which supplies the lowest-order bits.

Requirements

Header: <random>

Namespace: std

See Also

Reference

<random>

linear_congruential_engine Class

Other Resources

<random> Members