tmp/tmpws618k9x/{from.md → to.md}
RENAMED
|
@@ -9,24 +9,23 @@ all subscripts applied to X are to be taken modulo r. The state xᵢ
|
|
| 9 |
additionally consists of an integer c (known as the *carry*) whose value
|
| 10 |
is either 0 or 1.
|
| 11 |
|
| 12 |
The state transition is performed as follows:
|
| 13 |
|
| 14 |
-
This algorithm corresponds to a modular linear function of
|
| 15 |
-
TA(xᵢ) = (a ⋅ xᵢ) mod b, where b is of the form mʳ - mˢ + 1
|
| 16 |
-
a = b - (b-1) / m.
|
| 17 |
|
| 18 |
The generation algorithm is given by GA(xᵢ) = y, where y is the value
|
| 19 |
produced as a result of advancing the engine’s state as described above.
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
template<class UIntType, size_t w, size_t s, size_t r>
|
| 23 |
-
|
| 24 |
-
{
|
| 25 |
public:
|
| 26 |
// types
|
| 27 |
-
|
| 28 |
|
| 29 |
// engine characteristics
|
| 30 |
static constexpr size_t word_size = w;
|
| 31 |
static constexpr size_t short_lag = s;
|
| 32 |
static constexpr size_t long_lag = r;
|
|
|
|
| 9 |
additionally consists of an integer c (known as the *carry*) whose value
|
| 10 |
is either 0 or 1.
|
| 11 |
|
| 12 |
The state transition is performed as follows:
|
| 13 |
|
| 14 |
+
[*Note 1*: This algorithm corresponds to a modular linear function of
|
| 15 |
+
the form TA(xᵢ) = (a ⋅ xᵢ) mod b, where b is of the form mʳ - mˢ + 1
|
| 16 |
+
and a = b - (b-1) / m. — *end note*]
|
| 17 |
|
| 18 |
The generation algorithm is given by GA(xᵢ) = y, where y is the value
|
| 19 |
produced as a result of advancing the engine’s state as described above.
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
template<class UIntType, size_t w, size_t s, size_t r>
|
| 23 |
+
class subtract_with_carry_engine {
|
|
|
|
| 24 |
public:
|
| 25 |
// types
|
| 26 |
+
using result_type = UIntType;
|
| 27 |
|
| 28 |
// engine characteristics
|
| 29 |
static constexpr size_t word_size = w;
|
| 30 |
static constexpr size_t short_lag = s;
|
| 31 |
static constexpr size_t long_lag = r;
|