-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnumerics.tex
55 lines (47 loc) · 1.6 KB
/
numerics.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
\rSec0[numerics]{Numerics library}
\synopsis{Header \tcode{<experimental/ranges/random>} synopsis}
\begin{codeblock}
namespace std { namespace experimental { namespace ranges { inline namespace v1 {
template <class G>
concept bool UniformRandomNumberGenerator = @\seebelow@;
}}}}
\end{codeblock}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Uniform Random Number Generator requirements:
\rSec1[rand.req.urng]{Uniform random number generator requirements}%
\indextext{uniform random number generator!requirements|(}%
\indextext{requirements!uniform random number generator|(}
\begin{codeblock}
template <class G>
concept bool UniformRandomNumberGenerator =
Invocable<G&> &&
UnsignedIntegral<result_of_t<G&()>> &&
requires {
{ G::min() } -> Same<result_of_t<G&()>>&&;
{ G::max() } -> Same<result_of_t<G&()>>&&;
};
\end{codeblock}
\pnum
A \techterm{uniform random number generator}
\tcode{g} of type \tcode{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.
\enternote
The degree to which \tcode{g}'s results
approximate the ideal
is often determined statistically.
\exitnote
\pnum
Let \tcode{g} be any object of type \tcode{G}.
\tcode{UniformRandomNumberGenerator<G>} is satisfied only if
\begin{itemize}
\item Both \tcode{G::min()} and \tcode{G::max()} are constant expressions~(\cxxref{expr.const}).
\item \tcode{G::min() < G::max()}.
\item \tcode{G::min() <= g()}.
\item \tcode{g() <= G::max()}.
\item \tcode{g()} has amortized constant complexity.
\end{itemize}