From Jason Turner

[rand.util]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpyw8bues4/{from.md → to.md} +11 -9
tmp/tmpyw8bues4/{from.md → to.md} RENAMED
@@ -1,17 +1,18 @@
1
  ### Utilities <a id="rand.util">[[rand.util]]</a>
2
 
3
  #### Class `seed_seq` <a id="rand.util.seedseq">[[rand.util.seedseq]]</a>
4
 
5
  ``` cpp
 
6
  class seed_seq {
7
  public:
8
  // types
9
  using result_type = uint_least32_t;
10
 
11
  // constructors
12
- seed_seq();
13
  template<class T>
14
  seed_seq(initializer_list<T> il);
15
  template<class InputIterator>
16
  seed_seq(InputIterator begin, InputIterator end);
17
 
@@ -29,26 +30,25 @@ public:
29
  void operator=(const seed_seq&) = delete;
30
 
31
  private:
32
  vector<result_type> v; // exposition only
33
  };
 
34
  ```
35
 
36
  ``` cpp
37
- seed_seq();
38
  ```
39
 
40
  *Ensures:* `v.empty()` is `true`.
41
 
42
- *Throws:* Nothing.
43
-
44
  ``` cpp
45
  template<class T>
46
  seed_seq(initializer_list<T> il);
47
  ```
48
 
49
- *Mandates:* `T` is an integer type.
50
 
51
  *Effects:* Same as `seed_seq(il.begin(), il.end())`.
52
 
53
  ``` cpp
54
  template<class InputIterator>
@@ -164,14 +164,10 @@ copy(v.begin(), v.end(), dest);
164
  ``` cpp
165
  template<class RealType, size_t bits, class URBG>
166
  RealType generate_canonical(URBG& g);
167
  ```
168
 
169
- *Complexity:* Exactly k = max(1, ⌈ b / log₂ R ⌉) invocations of `g`,
170
- where b[^5] is the lesser of `numeric_limits<RealType>::digits` and
171
- `bits`, and R is the value of `g.max()` - `g.min()` + 1.
172
-
173
  *Effects:* Invokes `g()` k times to obtain values g₀, …, gₖ₋₁,
174
  respectively. Calculates a quantity
175
  $$S = \sum_{i=0}^{k-1} (g_i - \texttt{g.min()})
176
  \cdot R^i$$ using arithmetic of type `RealType`.
177
 
@@ -179,10 +175,16 @@ $$S = \sum_{i=0}^{k-1} (g_i - \texttt{g.min()})
179
 
180
  [*Note 1*: 0 ≤ S / Rᵏ < 1. — *end note*]
181
 
182
  *Throws:* What and when `g` throws.
183
 
 
 
 
 
 
 
184
  [*Note 2*: If the values gᵢ produced by `g` are uniformly distributed,
185
  the instantiation’s results are distributed as uniformly as possible.
186
  Obtaining a value in this way can be a useful step in the process of
187
  transforming a value generated by a uniform random bit generator into a
188
  value that can be delivered by a random number
 
1
  ### Utilities <a id="rand.util">[[rand.util]]</a>
2
 
3
  #### Class `seed_seq` <a id="rand.util.seedseq">[[rand.util.seedseq]]</a>
4
 
5
  ``` cpp
6
+ namespace std {
7
  class seed_seq {
8
  public:
9
  // types
10
  using result_type = uint_least32_t;
11
 
12
  // constructors
13
+ seed_seq() noexcept;
14
  template<class T>
15
  seed_seq(initializer_list<T> il);
16
  template<class InputIterator>
17
  seed_seq(InputIterator begin, InputIterator end);
18
 
 
30
  void operator=(const seed_seq&) = delete;
31
 
32
  private:
33
  vector<result_type> v; // exposition only
34
  };
35
+ }
36
  ```
37
 
38
  ``` cpp
39
+ seed_seq() noexcept;
40
  ```
41
 
42
  *Ensures:* `v.empty()` is `true`.
43
 
 
 
44
  ``` cpp
45
  template<class T>
46
  seed_seq(initializer_list<T> il);
47
  ```
48
 
49
+ *Constraints:* `T` is an integer type.
50
 
51
  *Effects:* Same as `seed_seq(il.begin(), il.end())`.
52
 
53
  ``` cpp
54
  template<class InputIterator>
 
164
  ``` cpp
165
  template<class RealType, size_t bits, class URBG>
166
  RealType generate_canonical(URBG& g);
167
  ```
168
 
 
 
 
 
169
  *Effects:* Invokes `g()` k times to obtain values g₀, …, gₖ₋₁,
170
  respectively. Calculates a quantity
171
  $$S = \sum_{i=0}^{k-1} (g_i - \texttt{g.min()})
172
  \cdot R^i$$ using arithmetic of type `RealType`.
173
 
 
175
 
176
  [*Note 1*: 0 ≤ S / Rᵏ < 1. — *end note*]
177
 
178
  *Throws:* What and when `g` throws.
179
 
180
+ *Complexity:* Exactly k = max(1, ⌈ b / log₂ R ⌉) invocations of `g`,
181
+ where b[^6]
182
+
183
+ is the lesser of `numeric_limits<RealType>::digits` and `bits`, and R is
184
+ the value of `g.max()` - `g.min()` + 1.
185
+
186
  [*Note 2*: If the values gᵢ produced by `g` are uniformly distributed,
187
  the instantiation’s results are distributed as uniformly as possible.
188
  Obtaining a value in this way can be a useful step in the process of
189
  transforming a value generated by a uniform random bit generator into a
190
  value that can be delivered by a random number