From Jason Turner

[rand.eng.lcong]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwdor6nu4/{from.md → to.md} +13 -15
tmp/tmpwdor6nu4/{from.md → to.md} RENAMED
@@ -21,11 +21,12 @@ template<class UIntType, UIntType a, UIntType c, UIntType m>
21
  static constexpr result_type min() { return c == 0u ? 1u: 0u; }
22
  static constexpr result_type max() { return m - 1u; }
23
  static constexpr result_type default_seed = 1u;
24
 
25
  // constructors and seeding functions
26
- explicit linear_congruential_engine(result_type s = default_seed);
 
27
  template<class Sseq> explicit linear_congruential_engine(Sseq& q);
28
  void seed(result_type s = default_seed);
29
  template<class Sseq> void seed(Sseq& q);
30
 
31
  // generating functions
@@ -33,37 +34,34 @@ template<class UIntType, UIntType a, UIntType c, UIntType m>
33
  void discard(unsigned long long z);
34
  };
35
  ```
36
 
37
  If the template parameter `m` is 0, the modulus m used throughout this
38
- section  [[rand.eng.lcong]] is `numeric_limits<result_type>::max()` plus
39
- 1.
40
 
41
  [*Note 1*: m need not be representable as a value of type
42
  `result_type`. — *end note*]
43
 
44
  If the template parameter `m` is not 0, the following relations shall
45
  hold: `a < m` and `c < m`.
46
 
47
  The textual representation consists of the value of xᵢ.
48
 
49
  ``` cpp
50
- explicit linear_congruential_engine(result_type s = default_seed);
51
  ```
52
 
53
- *Effects:* Constructs a `linear_congruential_engine` object. If
54
- c mod m is 0 and `s` mod m is 0, sets the engine’s state to 1,
55
- otherwise sets the engine’s state to `s` mod m.
56
 
57
  ``` cpp
58
  template<class Sseq> explicit linear_congruential_engine(Sseq& q);
59
  ```
60
 
61
- *Effects:* Constructs a `linear_congruential_engine` object. With
62
- $k = \left\lceil \frac{\log_2 m}
63
- {32}
64
- \right\rceil$ and a an array (or equivalent) of length
65
- k + 3, invokes `q.generate(`a+0`, `a+k+3`)` and then computes
66
- $S = \left(\sum_{j=0}^{k-1}a_{j+3} \cdot 2^{32j} \right) \bmod m$. If
67
- c mod m is 0 and S is 0, sets the engine’s state to 1, else sets the
68
- engine’s state to S.
69
 
 
21
  static constexpr result_type min() { return c == 0u ? 1u: 0u; }
22
  static constexpr result_type max() { return m - 1u; }
23
  static constexpr result_type default_seed = 1u;
24
 
25
  // constructors and seeding functions
26
+ linear_congruential_engine() : linear_congruential_engine(default_seed) {}
27
+ explicit linear_congruential_engine(result_type s);
28
  template<class Sseq> explicit linear_congruential_engine(Sseq& q);
29
  void seed(result_type s = default_seed);
30
  template<class Sseq> void seed(Sseq& q);
31
 
32
  // generating functions
 
34
  void discard(unsigned long long z);
35
  };
36
  ```
37
 
38
  If the template parameter `m` is 0, the modulus m used throughout this
39
+ subclause  [[rand.eng.lcong]] is `numeric_limits<result_type>::max()`
40
+ plus 1.
41
 
42
  [*Note 1*: m need not be representable as a value of type
43
  `result_type`. — *end note*]
44
 
45
  If the template parameter `m` is not 0, the following relations shall
46
  hold: `a < m` and `c < m`.
47
 
48
  The textual representation consists of the value of xᵢ.
49
 
50
  ``` cpp
51
+ explicit linear_congruential_engine(result_type s);
52
  ```
53
 
54
+ *Effects:* If c mod m is 0 and `s` mod m is 0, sets the engine’s
55
+ state to 1, otherwise sets the engine’s state to `s` mod m.
 
56
 
57
  ``` cpp
58
  template<class Sseq> explicit linear_congruential_engine(Sseq& q);
59
  ```
60
 
61
+ *Effects:* With $k = \left\lceil \frac{\log_2 m}{32} \right\rceil$ and a
62
+ an array (or equivalent) of length k + 3, invokes
63
+ `q.generate(`a + 0`, `a + k + 3`)` and then computes
64
+ $S = \left(\sum_{j = 0}^{k - 1} a_{j + 3} \cdot 2^{32j} \right) \bmod m$.
65
+ If c mod m is 0 and S is 0, sets the engine’s state to 1, else sets
66
+ the engine’s state to S.
 
 
67