Produces a floating point value from a Gaussian (Normal) distribution.

Synopsis

Declared in <absl/random/distributions.h>

template<
    typename RealType,
    typename URBG>
RealType
Gaussian(
    URBG&& urbg,
    RealType mean = 0,
    RealType stddev = 1);

Description

absl::Gaussian produces a floating point number selected from the Gaussian (ie. "Normal") distribution. T must be a floating point type, but may be inferred from the types of mean and stddev.

See https://en.wikipedia.org/wiki/Normal_distribution

Example:

absl::BitGen bitgen; ... double giraffe_height = absl::Gaussian(bitgen, 16.3, 3.3);

Return Value

A random value drawn from the Gaussian distribution.

Parameters

Name

Description

urbg

The uniform random bit generator.

mean

The mean of the distribution.

stddev

The standard deviation of the distribution.

Created with MrDocs