generate_canonical

Returns a floating-point value from a random sequence.

template<class RealType,
    size_t bits,
    class Engine>
    RealType generate_canonical(Engine& gen);

Parameters

  • gen
    The random number generator.

Remarks

The template function calls gen() repeatedly and packs the returned values into a floating-point value x of type RealType until it has gathered the specified number of mantissa bits in x. The specified number is the smaller of bits (which must be nonzero) and the full number of mantissa bits in RealType. The first call supplies the lowest-order bits. The function returns x.

Requirements

Header: <random>

Namespace: std

See Also

Reference

<random>

Other Resources

<random> Members