Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.21 KB

random-functions.md

File metadata and controls

36 lines (26 loc) · 1.21 KB
description title ms.date f1_keywords ms.assetid helpviewer_keywords
Learn more about: <random> functions
<random> functions
09/04/2019
random/std::generate_canonical
2ac9ec59-619b-4b85-a425-f729277c1bc8
std::generate_canonical

<random> functions

generate_canonical

Returns a floating-point value from a random sequence.

template <class RealType, size_t Bits, class Generator>
RealType generate_canonical(Generator& Gen);

Parameters

RealType
The floating point integral type. For possible types, see <random>.

Bits
The number of bits of randomness to use.

Generator
A random number generator class.

Gen
A reference to an instance of a random number generator of type Generator.

Remarks

The template function calls operator() of 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.