# C++ named requirements: UniformRandomBitGenerator

A uniform random bit generator is a function object returning unsigned integer values such that each value in the range of possible results has (ideally) equal probability.

Uniform random bit generators are not intended to be used as random number generators: they are used as the source of random bits (generated in bulk, for efficiency). Any uniform random bit generator may be plugged into any random number distribution in order to obtain a random number (formally, a random variate).

### Requirements

The type `G` satisfies UniformRandomBitGenerator 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()`. The function must be constexpr.
`G::max()` `T` Returns the largest value that G's operator() may return. The value is strictly greater than `G::min()`. The function must be constexpr.
`g()` `T` Returns a value in the closed interval `[G::min(), G::max()]`. Has amortized constant complexity.

All RandomNumberEngines satisfy this requirement.

### Standard library

The following standard library facilities expect a UniformRandomBitGenerator type.

 random_shuffleshuffle (until C++17)(C++11) randomly re-orders elements in a range (function template) generate_canonical (C++11) evenly distributes real values of given precision across [0, 1) (function template) uniform_int_distribution (C++11) produces integer values evenly distributed across a range (class template) uniform_real_distribution (C++11) produces real values evenly distributed across a range (class template) all other random number distributions

The following standard library facilities satisfy UniformRandomBitGenerator without additionally satisfying RandomNumberEngine:

 random_device (C++11) non-deterministic random number generator using hardware entropy source (class)
{"ft_lang_label":"__label__en","ft_lang_prob":0.691394,"math_prob":0.96633106,"size":2811,"snap":"2023-40-2023-50","text_gpt3_token_len":596,"char_repetition_ratio":0.12326327,"word_repetition_ratio":0.06735751,"special_character_ratio":0.20668802,"punctuation_ratio":0.11590909,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9925277,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-23T02:22:27Z\",\"WARC-Record-ID\":\"<urn:uuid:d9e1da1d-0166-4c74-a8fd-d86df1ec29b0>\",\"Content-Length\":\"20681\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6537baca-2d2f-4b76-8ae0-71f7c756bff1>\",\"WARC-Concurrent-To\":\"<urn:uuid:4dd6c370-55b5-4d27-9262-65c187139f5f>\",\"WARC-IP-Address\":\"104.21.20.147\",\"WARC-Target-URI\":\"https://runebook.dev/en/docs/cpp/named_req/uniformrandombitgenerator\",\"WARC-Payload-Digest\":\"sha1:PCUPVHRGNEW3QNBGT3FPR2U2E4QD64DI\",\"WARC-Block-Digest\":\"sha1:AZY2XTC2EODPFGRY2USYYPAK3XBH6UHQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233506429.78_warc_CC-MAIN-20230922234442-20230923024442-00859.warc.gz\"}"}