26
Numerics library
[numerics]
26.6
Random number generation
[rand]
26.6.3
Requirements
[rand.req]
26.6.3.3
Uniform random bit generator requirements
[rand.req.urng]
1
#
A
uniform random bit generator
g
of type
G
is a function object returning unsigned integer values such that each value in the range of possible results has (ideally) equal probability of being returned
.
[
Note
1
:
The degree to which
g
's results approximate the ideal is often determined statistically
.
—
end note
]
template
<
class
G
>
concept
uniform_random_bit_generator
=
invocable
<
G
&
>
&
&
unsigned_integral
<
invoke_result_t
<
G
&
>
>
&
&
requires
{
{
G
::
min
(
)
}
-
>
same_as
<
invoke_result_t
<
G
&
>
>
;
{
G
::
max
(
)
}
-
>
same_as
<
invoke_result_t
<
G
&
>
>
;
requires
bool_constant
<
(
G
::
min
(
)
<
G
::
max
(
)
)
>
::
value;
}
;
2
#
Let
g
be an object of type
G
.
G
models
uniform_random_bit_generator
only if
(2.1)
G
::
min
(
)
<
=
g
(
)
,
(2.2)
g
(
)
<
=
G
::
max
(
)
, and
(2.3)
g
(
)
has amortized constant complexity
.
3
#
A class
G
meets the
uniform random bit generator
requirements if
G
models
uniform_random_bit_generator
,
invoke_result_t
<
G
&
>
is an unsigned integer type (
[basic.
fundamental]
), and
G
provides a nested
typedef-name
result_type
that denotes the same type as
invoke_result_t
<
G
&
>
.