From Jason Turner

[rand.util]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpou4pfjjd/{from.md → to.md} +17 -21
tmp/tmpou4pfjjd/{from.md → to.md} RENAMED
@@ -1,15 +1,14 @@
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
- {
8
  public:
9
  // types
10
- typedef uint_least32_t result_type;
11
 
12
  // constructors
13
  seed_seq();
14
  template<class T>
15
  seed_seq(initializer_list<T> il);
@@ -19,11 +18,11 @@ public:
19
  // generating functions
20
  template<class RandomAccessIterator>
21
  void generate(RandomAccessIterator begin, RandomAccessIterator end);
22
 
23
  // property functions
24
- size_t size() const;
25
  template<class OutputIterator>
26
  void param(OutputIterator dest) const;
27
 
28
  // no copy functions
29
  seed_seq(const seed_seq& ) = delete;
@@ -73,12 +72,11 @@ for( InputIterator s = begin; s != end; ++s)
73
  template<class RandomAccessIterator>
74
  void generate(RandomAccessIterator begin, RandomAccessIterator end);
75
  ```
76
 
77
  *Requires:* `RandomAccessIterator` shall meet the requirements of a
78
- mutable random access iterator
79
- (Table  [[tab:iterator.random.access.requirements]]) type. Moreover,
80
  `iterator_traits<RandomAccessIterator>::value_type` shall denote an
81
  unsigned integer type capable of accommodating 32-bit quantities.
82
 
83
  *Effects:* Does nothing if `begin == end`. Otherwise, with
84
  s = `v.size()` and n = `end` - `begin`, fills the supplied range
@@ -89,29 +87,26 @@ $x \, \xor \, (x \, \rightshift \, 27)$:
89
 
90
  *Throws:* What and when `RandomAccessIterator` operations of `begin` and
91
  `end` throw.
92
 
93
  ``` cpp
94
- size_t size() const;
95
  ```
96
 
97
  *Returns:* The number of 32-bit units that would be returned by a call
98
  to `param()`.
99
 
100
- *Throws:* Nothing.
101
-
102
  *Complexity:* Constant time.
103
 
104
  ``` cpp
105
  template<class OutputIterator>
106
  void param(OutputIterator dest) const;
107
  ```
108
 
109
  *Requires:* `OutputIterator` shall satisfy the requirements of an output
110
- iterator (Table  [[tab:iterator.output.requirements]]) type. Moreover,
111
- the expression `*dest = rt` shall be valid for a value `rt` of type
112
- `result_type`.
113
 
114
  *Effects:* Copies the sequence of prepared 32-bit units to the given
115
  destination, as if by executing the following statement:
116
 
117
  ``` cpp
@@ -122,22 +117,23 @@ copy(v.begin(), v.end(), dest);
122
 
123
  #### Function template `generate_canonical` <a id="rand.util.canonical">[[rand.util.canonical]]</a>
124
 
125
  Each function instantiated from the template described in this section 
126
  [[rand.util.canonical]] maps the result of one or more invocations of a
127
- supplied uniform random number generator `g` to one member of the
128
- specified `RealType` such that, if the values gᵢ produced by `g` are
129
- uniformly distributed, the instantiation’s results tⱼ, 0 ≤ tⱼ < 1, are
130
- distributed as uniformly as possible as specified below.
131
 
132
- Obtaining a value in this way can be a useful step in the process of
133
- transforming a value generated by a uniform random number generator into
134
- a value that can be delivered by a random number distribution.
 
135
 
136
  ``` cpp
137
- template<class RealType, size_t bits, class URNG>
138
- RealType generate_canonical(URNG& g);
139
  ```
140
 
141
  *Complexity:* Exactly k = max(1, ⌈ b / log₂ R ⌉) invocations of `g`,
142
  where b[^5] is the lesser of `numeric_limits<RealType>::digits` and
143
  `bits`, and R is the value of `g.max()` - `g.min()` + 1.
 
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);
 
18
  // generating functions
19
  template<class RandomAccessIterator>
20
  void generate(RandomAccessIterator begin, RandomAccessIterator end);
21
 
22
  // property functions
23
+ size_t size() const noexcept;
24
  template<class OutputIterator>
25
  void param(OutputIterator dest) const;
26
 
27
  // no copy functions
28
  seed_seq(const seed_seq& ) = delete;
 
72
  template<class RandomAccessIterator>
73
  void generate(RandomAccessIterator begin, RandomAccessIterator end);
74
  ```
75
 
76
  *Requires:* `RandomAccessIterator` shall meet the requirements of a
77
+ mutable random access iterator ([[random.access.iterators]]). Moreover,
 
78
  `iterator_traits<RandomAccessIterator>::value_type` shall denote an
79
  unsigned integer type capable of accommodating 32-bit quantities.
80
 
81
  *Effects:* Does nothing if `begin == end`. Otherwise, with
82
  s = `v.size()` and n = `end` - `begin`, fills the supplied range
 
87
 
88
  *Throws:* What and when `RandomAccessIterator` operations of `begin` and
89
  `end` throw.
90
 
91
  ``` cpp
92
+ size_t size() const noexcept;
93
  ```
94
 
95
  *Returns:* The number of 32-bit units that would be returned by a call
96
  to `param()`.
97
 
 
 
98
  *Complexity:* Constant time.
99
 
100
  ``` cpp
101
  template<class OutputIterator>
102
  void param(OutputIterator dest) const;
103
  ```
104
 
105
  *Requires:* `OutputIterator` shall satisfy the requirements of an output
106
+ iterator ([[output.iterators]]). Moreover, the expression `*dest = rt`
107
+ shall be valid for a value `rt` of type `result_type`.
 
108
 
109
  *Effects:* Copies the sequence of prepared 32-bit units to the given
110
  destination, as if by executing the following statement:
111
 
112
  ``` cpp
 
117
 
118
  #### Function template `generate_canonical` <a id="rand.util.canonical">[[rand.util.canonical]]</a>
119
 
120
  Each function instantiated from the template described in this section 
121
  [[rand.util.canonical]] maps the result of one or more invocations of a
122
+ supplied uniform random bit generator `g` to one member of the specified
123
+ `RealType` such that, if the values gᵢ produced by `g` are uniformly
124
+ distributed, the instantiation’s results tⱼ, 0 ≤ tⱼ < 1, are distributed
125
+ as uniformly as possible as specified below.
126
 
127
+ [*Note 1*: Obtaining a value in this way can be a useful step in the
128
+ process of transforming a value generated by a uniform random bit
129
+ generator into a value that can be delivered by a random number
130
+ distribution. — *end note*]
131
 
132
  ``` cpp
133
+ template<class RealType, size_t bits, class URBG>
134
+ RealType generate_canonical(URBG& g);
135
  ```
136
 
137
  *Complexity:* Exactly k = max(1, ⌈ b / log₂ R ⌉) invocations of `g`,
138
  where b[^5] is the lesser of `numeric_limits<RealType>::digits` and
139
  `bits`, and R is the value of `g.max()` - `g.min()` + 1.