absl::uniform_int_distribution

This distribution produces random integer values uniformly distributed in the closed (inclusive) interval [a, b].

Synopsis

Declared in <absl/random/uniform_int_distribution.h>

template<typename IntType = int>
class uniform_int_distribution;

Description

Example:

absl::BitGen gen;

// Use the distribution to produce a value between 1 and 6, inclusive. int die_roll = absl::uniform_int_distribution<int>(1, 6)(gen);

Types

NameDescription
param_type The parameter set of the distribution.

Type Aliases

NameDescription
result_type The type of the values produced by the distribution.

Member Functions

NameDescription
uniform_int_distribution [constructor]Constructors
a Returns the lower bound of the interval.
b Returns the upper bound of the interval.
max Returns the largest value the distribution can produce.
min Returns the smallest value the distribution can produce.
operator() Function call operators
param param overloads
reset Resets the uniform int distribution.

Friends

NameDescription
absl::operator!=Compares two distributions for inequality.
absl::operator==Compares two distributions for equality.