From Jason Turner

[rand.eng.lcong]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpqhr562kg/{from.md → to.md} +14 -0
tmp/tmpqhr562kg/{from.md → to.md} RENAMED
@@ -6,10 +6,11 @@ object `x` is of size 1 and consists of a single integer. The transition
6
  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
  class linear_congruential_engine {
13
  public:
14
  // types
15
  using result_type = UIntType;
@@ -27,14 +28,27 @@ template<class UIntType, UIntType a, UIntType c, UIntType m>
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
33
  result_type operator()();
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.
 
6
  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
+ namespace std {
12
  template<class UIntType, UIntType a, UIntType c, UIntType m>
13
  class linear_congruential_engine {
14
  public:
15
  // types
16
  using result_type = UIntType;
 
28
  explicit linear_congruential_engine(result_type s);
29
  template<class Sseq> explicit linear_congruential_engine(Sseq& q);
30
  void seed(result_type s = default_seed);
31
  template<class Sseq> void seed(Sseq& q);
32
 
33
+ // equality operators
34
+ friend bool operator==(const linear_congruential_engine& x,
35
+ const linear_congruential_engine& y);
36
+
37
  // generating functions
38
  result_type operator()();
39
  void discard(unsigned long long z);
40
+
41
+ // inserters and extractors
42
+ template<class charT, class traits>
43
+ friend basic_ostream<charT, traits>&
44
+ operator<<(basic_ostream<charT, traits>& os, const linear_congruential_engine& x);
45
+ template<class charT, class traits>
46
+ friend basic_istream<charT, traits>&
47
+ operator>>(basic_istream<charT, traits>& is, linear_congruential_engine& x);
48
  };
49
+ }
50
  ```
51
 
52
  If the template parameter `m` is 0, the modulus m used throughout this
53
  subclause  [[rand.eng.lcong]] is `numeric_limits<result_type>::max()`
54
  plus 1.