tmp/tmphaimlz3d/{from.md → to.md}
RENAMED
|
@@ -1,21 +1,22 @@
|
|
| 1 |
#### Function template `generate_canonical` <a id="rand.util.canonical">[[rand.util.canonical]]</a>
|
| 2 |
|
| 3 |
Each function instantiated from the template described in this section
|
| 4 |
[[rand.util.canonical]] maps the result of one or more invocations of a
|
| 5 |
-
supplied uniform random
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
| 10 |
-
Obtaining a value in this way can be a useful step in the
|
| 11 |
-
transforming a value generated by a uniform random
|
| 12 |
-
a value that can be delivered by a random number
|
|
|
|
| 13 |
|
| 14 |
``` cpp
|
| 15 |
-
template<class RealType, size_t bits, class
|
| 16 |
-
RealType generate_canonical(
|
| 17 |
```
|
| 18 |
|
| 19 |
*Complexity:* Exactly k = max(1, ⌈ b / log₂ R ⌉) invocations of `g`,
|
| 20 |
where b[^5] is the lesser of `numeric_limits<RealType>::digits` and
|
| 21 |
`bits`, and R is the value of `g.max()` - `g.min()` + 1.
|
|
|
|
| 1 |
#### Function template `generate_canonical` <a id="rand.util.canonical">[[rand.util.canonical]]</a>
|
| 2 |
|
| 3 |
Each function instantiated from the template described in this section
|
| 4 |
[[rand.util.canonical]] maps the result of one or more invocations of a
|
| 5 |
+
supplied uniform random bit generator `g` to one member of the specified
|
| 6 |
+
`RealType` such that, if the values gᵢ produced by `g` are uniformly
|
| 7 |
+
distributed, the instantiation’s results tⱼ, 0 ≤ tⱼ < 1, are distributed
|
| 8 |
+
as uniformly as possible as specified below.
|
| 9 |
|
| 10 |
+
[*Note 1*: Obtaining a value in this way can be a useful step in the
|
| 11 |
+
process of transforming a value generated by a uniform random bit
|
| 12 |
+
generator into a value that can be delivered by a random number
|
| 13 |
+
distribution. — *end note*]
|
| 14 |
|
| 15 |
``` cpp
|
| 16 |
+
template<class RealType, size_t bits, class URBG>
|
| 17 |
+
RealType generate_canonical(URBG& g);
|
| 18 |
```
|
| 19 |
|
| 20 |
*Complexity:* Exactly k = max(1, ⌈ b / log₂ R ⌉) invocations of `g`,
|
| 21 |
where b[^5] is the lesser of `numeric_limits<RealType>::digits` and
|
| 22 |
`bits`, and R is the value of `g.max()` - `g.min()` + 1.
|