absl::Uniform

Uniform overloads

Synopses

Declared in <absl/random/distributions.h>

Produces random values across the full range of an unsigned type.

template<
    typename R,
    typename URBG>
R
Uniform(URBG&& urbg)
requires !std::numeric_limits<R>::is_signed;
» more...

Produces random values of type T uniformly distributed in [lo, hi).]

template<
    typename R = void,
    typename URBG>
R
Uniform(
    URBG&& urbg,
    R lo,
    R hi)
requires !std::is_same_v<R, void>;
» more...

Produces random values in [lo, hi) with an inferred return type.]

template<
    typename R = void,
    typename URBG,
    typename A,
    typename B>
/* implementation-defined */::uniform_inferred_return_t<A, B>
Uniform(
    URBG&& urbg,
    A lo,
    B hi)
requires std::is_same_v<R, void>;
» more...

Produces random values of type T uniformly distributed in an interval.

template<
    typename R = void,
    typename TagType,
    typename URBG>
R
Uniform(
    TagType tag,
    URBG&& urbg,
    R lo,
    R hi)
requires !std::is_same_v<R, void>;
» more...

Produces random values with an interval tag and inferred return type.

template<
    typename R = void,
    typename TagType,
    typename URBG,
    typename A,
    typename B>
/* implementation-defined */::uniform_inferred_return_t<A, B>
Uniform(
    TagType tag,
    URBG&& urbg,
    A lo,
    B hi)
requires std::is_same_v<R, void>;
» more...

Return Value

  • A random value uniformly distributed across the range of R.
  • A random value uniformly distributed in [lo, hi).]
  • A random value uniformly distributed in the interval.

Parameters

NameDescription
urbgThe uniform random bit generator.
loThe inclusive lower bound of the interval.
hiThe exclusive upper bound of the interval.
tagThe interval tag selecting which endpoints are included.