Namespaces
Variants
Views
Actions

cpp/named req/UniformRandomBitGenerator

From cppreference.com
< cpp‎ | named req
Revision as of 12:00, 6 August 2014 by Cubbi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:cpp/concept/title Template:cpp/concept/navbar

A uniform random number generator is a function object returning unsigned integer values such that each value in the range of possible results has (ideally) equal probability. Any uniform random number generator may be plugged into any random number distribution.

Requirements

The type G satisfies UniformRandomNumberGenerator if

Given

  • T, the type named by G::result_type
  • g, a value of type G

The following expressions must be valid and have their specified effects

Expression Return type Requirements
G::result_type T T is an unsigned integer type
G::min() T Returns the smallest value that G's operator() may return. The value is strictly less than G::max().
G::max() T Returns the largest value that G's operator() may return. The value is strictly greater than G::min()
g() T Returns a value in the closed interval [G::min(), G::max()]. Has amortized constant complexity.

Notes

All Template:concepts satisfy this concept.

Standard library

The following standard library facilities expect a Template:concept type.

(until C++17)(C++11)
randomly re-orders elements in a range
(function template) [edit]
evenly distributes real values of given precision across [01)
(function template) [edit]
produces integer values evenly distributed across a range
(class template) [edit]
produces real values evenly distributed across a range
(class template) [edit]
all other random number distributions

The following standard library facilities satisfy Template:concept without additionally satisfying Template:concept:

non-deterministic random number generator using hardware entropy source
(class) [edit]