From Jason Turner

[rand.util.canonical]

Diff to HTML by rtfpessoa

tmp/tmpldwngrvg/{from.md → to.md} RENAMED
@@ -3,14 +3,10 @@
3
  ``` cpp
4
  template<class RealType, size_t bits, class URBG>
5
  RealType generate_canonical(URBG& g);
6
  ```
7
 
8
- *Complexity:* Exactly k = max(1, ⌈ b / log₂ R ⌉) invocations of `g`,
9
- where b[^5] is the lesser of `numeric_limits<RealType>::digits` and
10
- `bits`, and R is the value of `g.max()` - `g.min()` + 1.
11
-
12
  *Effects:* Invokes `g()` k times to obtain values g₀, …, gₖ₋₁,
13
  respectively. Calculates a quantity
14
  $$S = \sum_{i=0}^{k-1} (g_i - \texttt{g.min()})
15
  \cdot R^i$$ using arithmetic of type `RealType`.
16
 
@@ -18,10 +14,16 @@ $$S = \sum_{i=0}^{k-1} (g_i - \texttt{g.min()})
18
 
19
  [*Note 1*: 0 ≤ S / Rᵏ < 1. — *end note*]
20
 
21
  *Throws:* What and when `g` throws.
22
 
 
 
 
 
 
 
23
  [*Note 2*: If the values gᵢ produced by `g` are uniformly distributed,
24
  the instantiation’s results are distributed as uniformly as possible.
25
  Obtaining a value in this way can be a useful step in the process of
26
  transforming a value generated by a uniform random bit generator into a
27
  value that can be delivered by a random number
 
3
  ``` cpp
4
  template<class RealType, size_t bits, class URBG>
5
  RealType generate_canonical(URBG& g);
6
  ```
7
 
 
 
 
 
8
  *Effects:* Invokes `g()` k times to obtain values g₀, …, gₖ₋₁,
9
  respectively. Calculates a quantity
10
  $$S = \sum_{i=0}^{k-1} (g_i - \texttt{g.min()})
11
  \cdot R^i$$ using arithmetic of type `RealType`.
12
 
 
14
 
15
  [*Note 1*: 0 ≤ S / Rᵏ < 1. — *end note*]
16
 
17
  *Throws:* What and when `g` throws.
18
 
19
+ *Complexity:* Exactly k = max(1, ⌈ b / log₂ R ⌉) invocations of `g`,
20
+ where b[^6]
21
+
22
+ is the lesser of `numeric_limits<RealType>::digits` and `bits`, and R is
23
+ the value of `g.max()` - `g.min()` + 1.
24
+
25
  [*Note 2*: If the values gᵢ produced by `g` are uniformly distributed,
26
  the instantiation’s results are distributed as uniformly as possible.
27
  Obtaining a value in this way can be a useful step in the process of
28
  transforming a value generated by a uniform random bit generator into a
29
  value that can be delivered by a random number