tmp/tmp91_0douo/{from.md → to.md}
RENAMED
|
@@ -7,15 +7,14 @@ algorithm is a modular linear function of the form
|
|
| 7 |
TA(xᵢ) = (a ⋅ xᵢ + c) mod m; the generation algorithm is
|
| 8 |
GA(xᵢ) = xᵢ₊₁.
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
template<class UIntType, UIntType a, UIntType c, UIntType m>
|
| 12 |
-
|
| 13 |
-
{
|
| 14 |
public:
|
| 15 |
// types
|
| 16 |
-
|
| 17 |
|
| 18 |
// engine characteristics
|
| 19 |
static constexpr result_type multiplier = a;
|
| 20 |
static constexpr result_type increment = c;
|
| 21 |
static constexpr result_type modulus = m;
|
|
@@ -35,11 +34,14 @@ public:
|
|
| 35 |
};
|
| 36 |
```
|
| 37 |
|
| 38 |
If the template parameter `m` is 0, the modulus m used throughout this
|
| 39 |
section [[rand.eng.lcong]] is `numeric_limits<result_type>::max()` plus
|
| 40 |
-
1.
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
If the template parameter `m` is not 0, the following relations shall
|
| 43 |
hold: `a < m` and `c < m`.
|
| 44 |
|
| 45 |
The textual representation consists of the value of xᵢ.
|
|
|
|
| 7 |
TA(xᵢ) = (a ⋅ xᵢ + c) mod m; the generation algorithm is
|
| 8 |
GA(xᵢ) = xᵢ₊₁.
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
template<class UIntType, UIntType a, UIntType c, UIntType m>
|
| 12 |
+
class linear_congruential_engine {
|
|
|
|
| 13 |
public:
|
| 14 |
// types
|
| 15 |
+
using result_type = UIntType;
|
| 16 |
|
| 17 |
// engine characteristics
|
| 18 |
static constexpr result_type multiplier = a;
|
| 19 |
static constexpr result_type increment = c;
|
| 20 |
static constexpr result_type modulus = m;
|
|
|
|
| 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ᵢ.
|