From Jason Turner

[rand.dist]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpts9puygr/{from.md → to.md} +266 -1
tmp/tmpts9puygr/{from.md → to.md} RENAMED
@@ -27,10 +27,11 @@ outside its stated domain.
27
  A `uniform_int_distribution` random number distribution produces random
28
  integers i, a ≤ i ≤ b, distributed according to the constant discrete
29
  probability function $$P(i\,|\,a,b) = 1 / (b - a + 1) \text{ .}$$
30
 
31
  ``` cpp
 
32
  template<class IntType = int>
33
  class uniform_int_distribution {
34
  public:
35
  // types
36
  using result_type = IntType;
@@ -40,10 +41,13 @@ template<class IntType = int>
40
  uniform_int_distribution() : uniform_int_distribution(0) {}
41
  explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
42
  explicit uniform_int_distribution(const param_type& parm);
43
  void reset();
44
 
 
 
 
45
  // generating functions
46
  template<class URBG>
47
  result_type operator()(URBG& g);
48
  template<class URBG>
49
  result_type operator()(URBG& g, const param_type& parm);
@@ -53,11 +57,20 @@ template<class IntType = int>
53
  result_type b() const;
54
  param_type param() const;
55
  void param(const param_type& parm);
56
  result_type min() const;
57
  result_type max() const;
 
 
 
 
 
 
 
 
58
  };
 
59
  ```
60
 
61
  ``` cpp
62
  explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
63
  ```
@@ -89,10 +102,11 @@ density function $$p(x\,|\,a,b) = 1 / (b - a) \text{ .}$$
89
 
90
  [*Note 1*: This implies that p(x | a,b) is undefined when
91
  `a == b`. — *end note*]
92
 
93
  ``` cpp
 
94
  template<class RealType = double>
95
  class uniform_real_distribution {
96
  public:
97
  // types
98
  using result_type = RealType;
@@ -102,10 +116,14 @@ template<class RealType = double>
102
  uniform_real_distribution() : uniform_real_distribution(0.0) {}
103
  explicit uniform_real_distribution(RealType a, RealType b = 1.0);
104
  explicit uniform_real_distribution(const param_type& parm);
105
  void reset();
106
 
 
 
 
 
107
  // generating functions
108
  template<class URBG>
109
  result_type operator()(URBG& g);
110
  template<class URBG>
111
  result_type operator()(URBG& g, const param_type& parm);
@@ -115,11 +133,20 @@ template<class RealType = double>
115
  result_type b() const;
116
  param_type param() const;
117
  void param(const param_type& parm);
118
  result_type min() const;
119
  result_type max() const;
 
 
 
 
 
 
 
 
120
  };
 
121
  ```
122
 
123
  ``` cpp
124
  explicit uniform_real_distribution(RealType a, RealType b = 1.0);
125
  ```
@@ -154,10 +181,11 @@ $$P(b\,|\,p) = \left\{ \begin{array}{ll}
154
  p & \text{ if $b = \tcode{true}$, or} \\
155
  1 - p & \text{ if $b = \tcode{false}$.}
156
  \end{array}\right.$$
157
 
158
  ``` cpp
 
159
  class bernoulli_distribution {
160
  public:
161
  // types
162
  using result_type = bool;
163
  using param_type = unspecified;
@@ -166,10 +194,13 @@ public:
166
  bernoulli_distribution() : bernoulli_distribution(0.5) {}
167
  explicit bernoulli_distribution(double p);
168
  explicit bernoulli_distribution(const param_type& parm);
169
  void reset();
170
 
 
 
 
171
  // generating functions
172
  template<class URBG>
173
  result_type operator()(URBG& g);
174
  template<class URBG>
175
  result_type operator()(URBG& g, const param_type& parm);
@@ -178,11 +209,20 @@ public:
178
  double p() const;
179
  param_type param() const;
180
  void param(const param_type& parm);
181
  result_type min() const;
182
  result_type max() const;
 
 
 
 
 
 
 
 
183
  };
 
184
  ```
185
 
186
  ``` cpp
187
  explicit bernoulli_distribution(double p);
188
  ```
@@ -203,10 +243,11 @@ constructed.
203
  A `binomial_distribution` random number distribution produces integer
204
  values i ≥ 0 distributed according to the discrete probability function
205
  $$P(i\,|\,t,p) = \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i} \text{ .}$$
206
 
207
  ``` cpp
 
208
  template<class IntType = int>
209
  class binomial_distribution {
210
  public:
211
  // types
212
  using result_type = IntType;
@@ -216,10 +257,13 @@ template<class IntType = int>
216
  binomial_distribution() : binomial_distribution(1) {}
217
  explicit binomial_distribution(IntType t, double p = 0.5);
218
  explicit binomial_distribution(const param_type& parm);
219
  void reset();
220
 
 
 
 
221
  // generating functions
222
  template<class URBG>
223
  result_type operator()(URBG& g);
224
  template<class URBG>
225
  result_type operator()(URBG& g, const param_type& parm);
@@ -229,11 +273,20 @@ template<class IntType = int>
229
  double p() const;
230
  param_type param() const;
231
  void param(const param_type& parm);
232
  result_type min() const;
233
  result_type max() const;
 
 
 
 
 
 
 
 
234
  };
 
235
  ```
236
 
237
  ``` cpp
238
  explicit binomial_distribution(IntType t, double p = 0.5);
239
  ```
@@ -262,10 +315,11 @@ constructed.
262
  A `geometric_distribution` random number distribution produces integer
263
  values i ≥ 0 distributed according to the discrete probability function
264
  $$P(i\,|\,p) = p \cdot (1-p)^{i} \text{ .}$$
265
 
266
  ``` cpp
 
267
  template<class IntType = int>
268
  class geometric_distribution {
269
  public:
270
  // types
271
  using result_type = IntType;
@@ -275,10 +329,13 @@ template<class IntType = int>
275
  geometric_distribution() : geometric_distribution(0.5) {}
276
  explicit geometric_distribution(double p);
277
  explicit geometric_distribution(const param_type& parm);
278
  void reset();
279
 
 
 
 
280
  // generating functions
281
  template<class URBG>
282
  result_type operator()(URBG& g);
283
  template<class URBG>
284
  result_type operator()(URBG& g, const param_type& parm);
@@ -287,11 +344,20 @@ template<class IntType = int>
287
  double p() const;
288
  param_type param() const;
289
  void param(const param_type& parm);
290
  result_type min() const;
291
  result_type max() const;
 
 
 
 
 
 
 
 
292
  };
 
293
  ```
294
 
295
  ``` cpp
296
  explicit geometric_distribution(double p);
297
  ```
@@ -316,10 +382,11 @@ $$P(i\,|\,k,p) = \binom{k+i-1}{i} \cdot p^k \cdot (1-p)^i \text{ .}$$
316
 
317
  [*Note 1*: This implies that P(i | k,p) is undefined when
318
  `p == 1`. — *end note*]
319
 
320
  ``` cpp
 
321
  template<class IntType = int>
322
  class negative_binomial_distribution {
323
  public:
324
  // types
325
  using result_type = IntType;
@@ -329,10 +396,14 @@ template<class IntType = int>
329
  negative_binomial_distribution() : negative_binomial_distribution(1) {}
330
  explicit negative_binomial_distribution(IntType k, double p = 0.5);
331
  explicit negative_binomial_distribution(const param_type& parm);
332
  void reset();
333
 
 
 
 
 
334
  // generating functions
335
  template<class URBG>
336
  result_type operator()(URBG& g);
337
  template<class URBG>
338
  result_type operator()(URBG& g, const param_type& parm);
@@ -342,11 +413,20 @@ template<class IntType = int>
342
  double p() const;
343
  param_type param() const;
344
  void param(const param_type& parm);
345
  result_type min() const;
346
  result_type max() const;
 
 
 
 
 
 
 
 
347
  };
 
348
  ```
349
 
350
  ``` cpp
351
  explicit negative_binomial_distribution(IntType k, double p = 0.5);
352
  ```
@@ -392,10 +472,13 @@ template<class IntType = int>
392
  poisson_distribution() : poisson_distribution(1.0) {}
393
  explicit poisson_distribution(double mean);
394
  explicit poisson_distribution(const param_type& parm);
395
  void reset();
396
 
 
 
 
397
  // generating functions
398
  template<class URBG>
399
  result_type operator()(URBG& g);
400
  template<class URBG>
401
  result_type operator()(URBG& g, const param_type& parm);
@@ -404,10 +487,18 @@ template<class IntType = int>
404
  double mean() const;
405
  param_type param() const;
406
  void param(const param_type& parm);
407
  result_type min() const;
408
  result_type max() const;
 
 
 
 
 
 
 
 
409
  };
410
  ```
411
 
412
  ``` cpp
413
  explicit poisson_distribution(double mean);
@@ -429,10 +520,11 @@ constructed.
429
  An `exponential_distribution` random number distribution produces random
430
  numbers x > 0 distributed according to the probability density function
431
  $$p(x\,|\,\lambda) = \lambda e^{-\lambda x} \text{ .}$$
432
 
433
  ``` cpp
 
434
  template<class RealType = double>
435
  class exponential_distribution {
436
  public:
437
  // types
438
  using result_type = RealType;
@@ -442,10 +534,13 @@ template<class RealType = double>
442
  exponential_distribution() : exponential_distribution(1.0) {}
443
  explicit exponential_distribution(RealType lambda);
444
  explicit exponential_distribution(const param_type& parm);
445
  void reset();
446
 
 
 
 
447
  // generating functions
448
  template<class URBG>
449
  result_type operator()(URBG& g);
450
  template<class URBG>
451
  result_type operator()(URBG& g, const param_type& parm);
@@ -454,11 +549,20 @@ template<class RealType = double>
454
  RealType lambda() const;
455
  param_type param() const;
456
  void param(const param_type& parm);
457
  result_type min() const;
458
  result_type max() const;
 
 
 
 
 
 
 
 
459
  };
 
460
  ```
461
 
462
  ``` cpp
463
  explicit exponential_distribution(RealType lambda);
464
  ```
@@ -481,10 +585,11 @@ numbers x > 0 distributed according to the probability density function
481
  $$p(x\,|\,\alpha,\beta) =
482
  \frac{e^{-x/\beta}}{\beta^{\alpha} \cdot \Gamma(\alpha)} \, \cdot \, x^{\, \alpha-1}
483
  \text{ .}$$
484
 
485
  ``` cpp
 
486
  template<class RealType = double>
487
  class gamma_distribution {
488
  public:
489
  // types
490
  using result_type = RealType;
@@ -494,10 +599,13 @@ template<class RealType = double>
494
  gamma_distribution() : gamma_distribution(1.0) {}
495
  explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
496
  explicit gamma_distribution(const param_type& parm);
497
  void reset();
498
 
 
 
 
499
  // generating functions
500
  template<class URBG>
501
  result_type operator()(URBG& g);
502
  template<class URBG>
503
  result_type operator()(URBG& g, const param_type& parm);
@@ -507,11 +615,20 @@ template<class RealType = double>
507
  RealType beta() const;
508
  param_type param() const;
509
  void param(const param_type& parm);
510
  result_type min() const;
511
  result_type max() const;
 
 
 
 
 
 
 
 
512
  };
 
513
  ```
514
 
515
  ``` cpp
516
  explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
517
  ```
@@ -543,10 +660,11 @@ $$p(x\,|\,a,b) = \frac{a}{b}
543
  \cdot \left(\frac{x}{b}\right)^{a-1}
544
  \cdot \, \exp\left( -\left(\frac{x}{b}\right)^a\right)
545
  \text{ .}$$
546
 
547
  ``` cpp
 
548
  template<class RealType = double>
549
  class weibull_distribution {
550
  public:
551
  // types
552
  using result_type = RealType;
@@ -556,10 +674,13 @@ template<class RealType = double>
556
  weibull_distribution() : weibull_distribution(1.0) {}
557
  explicit weibull_distribution(RealType a, RealType b = 1.0);
558
  explicit weibull_distribution(const param_type& parm);
559
  void reset();
560
 
 
 
 
561
  // generating functions
562
  template<class URBG>
563
  result_type operator()(URBG& g);
564
  template<class URBG>
565
  result_type operator()(URBG& g, const param_type& parm);
@@ -569,11 +690,20 @@ template<class RealType = double>
569
  RealType b() const;
570
  param_type param() const;
571
  void param(const param_type& parm);
572
  result_type min() const;
573
  result_type max() const;
 
 
 
 
 
 
 
 
574
  };
 
575
  ```
576
 
577
  ``` cpp
578
  explicit weibull_distribution(RealType a, RealType b = 1.0);
579
  ```
@@ -599,15 +729,18 @@ constructed.
599
 
600
  ##### Class template `extreme_value_distribution` <a id="rand.dist.pois.extreme">[[rand.dist.pois.extreme]]</a>
601
 
602
  An `extreme_value_distribution` random number distribution produces
603
  random numbers x distributed according to the probability density
604
- function[^6] $$p(x\,|\,a,b) = \frac{1}{b}
 
 
605
  \cdot \exp\left(\frac{a-x}{b} - \exp\left(\frac{a-x}{b}\right)\right)
606
  \text{ .}$$
607
 
608
  ``` cpp
 
609
  template<class RealType = double>
610
  class extreme_value_distribution {
611
  public:
612
  // types
613
  using result_type = RealType;
@@ -617,10 +750,14 @@ template<class RealType = double>
617
  extreme_value_distribution() : extreme_value_distribution(0.0) {}
618
  explicit extreme_value_distribution(RealType a, RealType b = 1.0);
619
  explicit extreme_value_distribution(const param_type& parm);
620
  void reset();
621
 
 
 
 
 
622
  // generating functions
623
  template<class URBG>
624
  result_type operator()(URBG& g);
625
  template<class URBG>
626
  result_type operator()(URBG& g, const param_type& parm);
@@ -630,11 +767,20 @@ template<class RealType = double>
630
  RealType b() const;
631
  param_type param() const;
632
  void param(const param_type& parm);
633
  result_type min() const;
634
  result_type max() const;
 
 
 
 
 
 
 
 
635
  };
 
636
  ```
637
 
638
  ``` cpp
639
  explicit extreme_value_distribution(RealType a, RealType b = 1.0);
640
  ```
@@ -674,10 +820,11 @@ numbers x distributed according to the probability density function $$%
674
  }
675
  \text{ .}$$ The distribution parameters μ and σ are also known as this
676
  distribution’s *mean* and *standard deviation*.
677
 
678
  ``` cpp
 
679
  template<class RealType = double>
680
  class normal_distribution {
681
  public:
682
  // types
683
  using result_type = RealType;
@@ -687,10 +834,13 @@ template<class RealType = double>
687
  normal_distribution() : normal_distribution(0.0) {}
688
  explicit normal_distribution(RealType mean, RealType stddev = 1.0);
689
  explicit normal_distribution(const param_type& parm);
690
  void reset();
691
 
 
 
 
692
  // generating functions
693
  template<class URBG>
694
  result_type operator()(URBG& g);
695
  template<class URBG>
696
  result_type operator()(URBG& g, const param_type& parm);
@@ -700,11 +850,20 @@ template<class RealType = double>
700
  RealType stddev() const;
701
  param_type param() const;
702
  void param(const param_type& parm);
703
  result_type min() const;
704
  result_type max() const;
 
 
 
 
 
 
 
 
705
  };
 
706
  ```
707
 
708
  ``` cpp
709
  explicit normal_distribution(RealType mean, RealType stddev = 1.0);
710
  ```
@@ -735,10 +894,11 @@ numbers x > 0 distributed according to the probability density function
735
  $$p(x\,|\,m,s) = \frac{1}{s x \sqrt{2 \pi}}
736
  \cdot \exp{\left(-\frac{(\ln{x} - m)^2}{2 s^2}\right)}
737
  \text{ .}$$
738
 
739
  ``` cpp
 
740
  template<class RealType = double>
741
  class lognormal_distribution {
742
  public:
743
  // types
744
  using result_type = RealType;
@@ -748,10 +908,13 @@ template<class RealType = double>
748
  lognormal_distribution() : lognormal_distribution(0.0) {}
749
  explicit lognormal_distribution(RealType m, RealType s = 1.0);
750
  explicit lognormal_distribution(const param_type& parm);
751
  void reset();
752
 
 
 
 
753
  // generating functions
754
  template<class URBG>
755
  result_type operator()(URBG& g);
756
  template<class URBG>
757
  result_type operator()(URBG& g, const param_type& parm);
@@ -761,11 +924,20 @@ template<class RealType = double>
761
  RealType s() const;
762
  param_type param() const;
763
  void param(const param_type& parm);
764
  result_type min() const;
765
  result_type max() const;
 
 
 
 
 
 
 
 
766
  };
 
767
  ```
768
 
769
  ``` cpp
770
  explicit lognormal_distribution(RealType m, RealType s = 1.0);
771
  ```
@@ -794,10 +966,11 @@ constructed.
794
  A `chi_squared_distribution` random number distribution produces random
795
  numbers x > 0 distributed according to the probability density function
796
  $$p(x\,|\,n) = \frac{x^{(n/2)-1} \cdot e^{-x/2}}{\Gamma(n/2) \cdot 2^{n/2}} \text{ .}$$
797
 
798
  ``` cpp
 
799
  template<class RealType = double>
800
  class chi_squared_distribution {
801
  public:
802
  // types
803
  using result_type = RealType;
@@ -807,10 +980,13 @@ template<class RealType = double>
807
  chi_squared_distribution() : chi_squared_distribution(1.0) {}
808
  explicit chi_squared_distribution(RealType n);
809
  explicit chi_squared_distribution(const param_type& parm);
810
  void reset();
811
 
 
 
 
812
  // generating functions
813
  template<class URBG>
814
  result_type operator()(URBG& g);
815
  template<class URBG>
816
  result_type operator()(URBG& g, const param_type& parm);
@@ -819,11 +995,20 @@ template<class RealType = double>
819
  RealType n() const;
820
  param_type param() const;
821
  void param(const param_type& parm);
822
  result_type min() const;
823
  result_type max() const;
 
 
 
 
 
 
 
 
824
  };
 
825
  ```
826
 
827
  ``` cpp
828
  explicit chi_squared_distribution(RealType n);
829
  ```
@@ -844,10 +1029,11 @@ constructed.
844
  A `cauchy_distribution` random number distribution produces random
845
  numbers x distributed according to the probability density function
846
  $$p(x\,|\,a,b) = \left(\pi b \left(1 + \left(\frac{x-a}{b} \right)^2 \, \right)\right)^{-1} \text{ .}$$
847
 
848
  ``` cpp
 
849
  template<class RealType = double>
850
  class cauchy_distribution {
851
  public:
852
  // types
853
  using result_type = RealType;
@@ -857,10 +1043,13 @@ template<class RealType = double>
857
  cauchy_distribution() : cauchy_distribution(0.0) {}
858
  explicit cauchy_distribution(RealType a, RealType b = 1.0);
859
  explicit cauchy_distribution(const param_type& parm);
860
  void reset();
861
 
 
 
 
862
  // generating functions
863
  template<class URBG>
864
  result_type operator()(URBG& g);
865
  template<class URBG>
866
  result_type operator()(URBG& g, const param_type& parm);
@@ -870,11 +1059,20 @@ template<class RealType = double>
870
  RealType b() const;
871
  param_type param() const;
872
  void param(const param_type& parm);
873
  result_type min() const;
874
  result_type max() const;
 
 
 
 
 
 
 
 
875
  };
 
876
  ```
877
 
878
  ``` cpp
879
  explicit cauchy_distribution(RealType a, RealType b = 1.0);
880
  ```
@@ -907,10 +1105,11 @@ $$p(x\,|\,m,n) = \frac{\Gamma\big((m+n)/2\big)}{\Gamma(m/2) \; \Gamma(n/2)}
907
  \cdot x^{(m/2)-1}
908
  \cdot \left(1 + \frac{m x}{n}\right)^{-(m + n)/2}
909
  \text{ .}$$
910
 
911
  ``` cpp
 
912
  template<class RealType = double>
913
  class fisher_f_distribution {
914
  public:
915
  // types
916
  using result_type = RealType;
@@ -920,10 +1119,13 @@ template<class RealType = double>
920
  fisher_f_distribution() : fisher_f_distribution(1.0) {}
921
  explicit fisher_f_distribution(RealType m, RealType n = 1.0);
922
  explicit fisher_f_distribution(const param_type& parm);
923
  void reset();
924
 
 
 
 
925
  // generating functions
926
  template<class URBG>
927
  result_type operator()(URBG& g);
928
  template<class URBG>
929
  result_type operator()(URBG& g, const param_type& parm);
@@ -933,11 +1135,20 @@ template<class RealType = double>
933
  RealType n() const;
934
  param_type param() const;
935
  void param(const param_type& parm);
936
  result_type min() const;
937
  result_type max() const;
 
 
 
 
 
 
 
 
938
  };
 
939
  ```
940
 
941
  ``` cpp
942
  explicit fisher_f_distribution(RealType m, RealType n = 1);
943
  ```
@@ -969,10 +1180,11 @@ $$p(x\,|\,n) = \frac{1}{\sqrt{n \pi}}
969
  \cdot \frac{\Gamma\big((n+1)/2\big)}{\Gamma(n/2)}
970
  \cdot \left(1 + \frac{x^2}{n} \right)^{-(n+1)/2}
971
  \text{ .}$$
972
 
973
  ``` cpp
 
974
  template<class RealType = double>
975
  class student_t_distribution {
976
  public:
977
  // types
978
  using result_type = RealType;
@@ -982,10 +1194,13 @@ template<class RealType = double>
982
  student_t_distribution() : student_t_distribution(1.0) {}
983
  explicit student_t_distribution(RealType n);
984
  explicit student_t_distribution(const param_type& parm);
985
  void reset();
986
 
 
 
 
987
  // generating functions
988
  template<class URBG>
989
  result_type operator()(URBG& g);
990
  template<class URBG>
991
  result_type operator()(URBG& g, const param_type& parm);
@@ -994,11 +1209,20 @@ template<class RealType = double>
994
  RealType n() const;
995
  param_type param() const;
996
  void param(const param_type& parm);
997
  result_type min() const;
998
  result_type max() const;
 
 
 
 
 
 
 
 
999
  };
 
1000
  ```
1001
 
1002
  ``` cpp
1003
  explicit student_t_distribution(RealType n);
1004
  ```
@@ -1027,10 +1251,11 @@ as: pₖ = {wₖ / S} for k = 0, …, n - 1, in which the values wₖ, commonly
1027
  known as the *weights* , shall be non-negative, non-NaN, and
1028
  non-infinity. Moreover, the following relation shall hold:
1029
  $0 < S = w_0 + \dotsb + w_{n - 1}$.
1030
 
1031
  ``` cpp
 
1032
  template<class IntType = int>
1033
  class discrete_distribution {
1034
  public:
1035
  // types
1036
  using result_type = IntType;
@@ -1044,10 +1269,13 @@ template<class IntType = int>
1044
  template<class UnaryOperation>
1045
  discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
1046
  explicit discrete_distribution(const param_type& parm);
1047
  void reset();
1048
 
 
 
 
1049
  // generating functions
1050
  template<class URBG>
1051
  result_type operator()(URBG& g);
1052
  template<class URBG>
1053
  result_type operator()(URBG& g, const param_type& parm);
@@ -1056,11 +1284,20 @@ template<class IntType = int>
1056
  vector<double> probabilities() const;
1057
  param_type param() const;
1058
  void param(const param_type& parm);
1059
  result_type min() const;
1060
  result_type max() const;
 
 
 
 
 
 
 
 
1061
  };
 
1062
  ```
1063
 
1064
  ``` cpp
1065
  discrete_distribution();
1066
  ```
@@ -1136,10 +1373,11 @@ $$\rho_k = \frac{w_k}{S \cdot (b_{k+1}-b_k)} \text{ for } k = 0, \dotsc, n - 1 \
1136
  in which the values wₖ, commonly known as the *weights* , shall be
1137
  non-negative, non-NaN, and non-infinity. Moreover, the following
1138
  relation shall hold: 0 < S = w₀ + … + wₙ₋₁.
1139
 
1140
  ``` cpp
 
1141
  template<class RealType = double>
1142
  class piecewise_constant_distribution {
1143
  public:
1144
  // types
1145
  using result_type = RealType;
@@ -1156,10 +1394,14 @@ template<class RealType = double>
1156
  piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax,
1157
  UnaryOperation fw);
1158
  explicit piecewise_constant_distribution(const param_type& parm);
1159
  void reset();
1160
 
 
 
 
 
1161
  // generating functions
1162
  template<class URBG>
1163
  result_type operator()(URBG& g);
1164
  template<class URBG>
1165
  result_type operator()(URBG& g, const param_type& parm);
@@ -1169,11 +1411,20 @@ template<class RealType = double>
1169
  vector<result_type> densities() const;
1170
  param_type param() const;
1171
  void param(const param_type& parm);
1172
  result_type min() const;
1173
  result_type max() const;
 
 
 
 
 
 
 
 
1174
  };
 
1175
  ```
1176
 
1177
  ``` cpp
1178
  piecewise_constant_distribution();
1179
  ```
@@ -1272,10 +1523,11 @@ in which the values wₖ, commonly known as the *weights at boundaries* ,
1272
  shall be non-negative, non-NaN, and non-infinity. Moreover, the
1273
  following relation shall hold:
1274
  $$0 < S = \frac{1}{2} \cdot \sum_{k=0}^{n-1} (w_k + w_{k+1}) \cdot (b_{k+1} - b_k) \text{ .}$$
1275
 
1276
  ``` cpp
 
1277
  template<class RealType = double>
1278
  class piecewise_linear_distribution {
1279
  public:
1280
  // types
1281
  using result_type = RealType;
@@ -1291,10 +1543,14 @@ template<class RealType = double>
1291
  template<class UnaryOperation>
1292
  piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
1293
  explicit piecewise_linear_distribution(const param_type& parm);
1294
  void reset();
1295
 
 
 
 
 
1296
  // generating functions
1297
  template<class URBG>
1298
  result_type operator()(URBG& g);
1299
  template<class URBG>
1300
  result_type operator()(URBG& g, const param_type& parm);
@@ -1304,11 +1560,20 @@ template<class RealType = double>
1304
  vector<result_type> densities() const;
1305
  param_type param() const;
1306
  void param(const param_type& parm);
1307
  result_type min() const;
1308
  result_type max() const;
 
 
 
 
 
 
 
 
1309
  };
 
1310
  ```
1311
 
1312
  ``` cpp
1313
  piecewise_linear_distribution();
1314
  ```
 
27
  A `uniform_int_distribution` random number distribution produces random
28
  integers i, a ≤ i ≤ b, distributed according to the constant discrete
29
  probability function $$P(i\,|\,a,b) = 1 / (b - a + 1) \text{ .}$$
30
 
31
  ``` cpp
32
+ namespace std {
33
  template<class IntType = int>
34
  class uniform_int_distribution {
35
  public:
36
  // types
37
  using result_type = IntType;
 
41
  uniform_int_distribution() : uniform_int_distribution(0) {}
42
  explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
43
  explicit uniform_int_distribution(const param_type& parm);
44
  void reset();
45
 
46
+ // equality operators
47
+ friend bool operator==(const uniform_int_distribution& x, const uniform_int_distribution& y);
48
+
49
  // generating functions
50
  template<class URBG>
51
  result_type operator()(URBG& g);
52
  template<class URBG>
53
  result_type operator()(URBG& g, const param_type& parm);
 
57
  result_type b() const;
58
  param_type param() const;
59
  void param(const param_type& parm);
60
  result_type min() const;
61
  result_type max() const;
62
+
63
+ // inserters and extractors
64
+ template<class charT, class traits>
65
+ friend basic_ostream<charT, traits>&
66
+ operator<<(basic_ostream<charT, traits>& os, const uniform_int_distribution& x);
67
+ template<class charT, class traits>
68
+ friend basic_istream<charT, traits>&
69
+ operator>>(basic_istream<charT, traits>& is, uniform_int_distribution& x);
70
  };
71
+ }
72
  ```
73
 
74
  ``` cpp
75
  explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
76
  ```
 
102
 
103
  [*Note 1*: This implies that p(x | a,b) is undefined when
104
  `a == b`. — *end note*]
105
 
106
  ``` cpp
107
+ namespace std {
108
  template<class RealType = double>
109
  class uniform_real_distribution {
110
  public:
111
  // types
112
  using result_type = RealType;
 
116
  uniform_real_distribution() : uniform_real_distribution(0.0) {}
117
  explicit uniform_real_distribution(RealType a, RealType b = 1.0);
118
  explicit uniform_real_distribution(const param_type& parm);
119
  void reset();
120
 
121
+ // equality operators
122
+ friend bool operator==(const uniform_real_distribution& x,
123
+ const uniform_real_distribution& y);
124
+
125
  // generating functions
126
  template<class URBG>
127
  result_type operator()(URBG& g);
128
  template<class URBG>
129
  result_type operator()(URBG& g, const param_type& parm);
 
133
  result_type b() const;
134
  param_type param() const;
135
  void param(const param_type& parm);
136
  result_type min() const;
137
  result_type max() const;
138
+
139
+ // inserters and extractors
140
+ template<class charT, class traits>
141
+ friend basic_ostream<charT, traits>&
142
+ operator<<(basic_ostream<charT, traits>& os, const uniform_real_distribution& x);
143
+ template<class charT, class traits>
144
+ friend basic_istream<charT, traits>&
145
+ operator>>(basic_istream<charT, traits>& is, uniform_real_distribution& x);
146
  };
147
+ }
148
  ```
149
 
150
  ``` cpp
151
  explicit uniform_real_distribution(RealType a, RealType b = 1.0);
152
  ```
 
181
  p & \text{ if $b = \tcode{true}$, or} \\
182
  1 - p & \text{ if $b = \tcode{false}$.}
183
  \end{array}\right.$$
184
 
185
  ``` cpp
186
+ namespace std {
187
  class bernoulli_distribution {
188
  public:
189
  // types
190
  using result_type = bool;
191
  using param_type = unspecified;
 
194
  bernoulli_distribution() : bernoulli_distribution(0.5) {}
195
  explicit bernoulli_distribution(double p);
196
  explicit bernoulli_distribution(const param_type& parm);
197
  void reset();
198
 
199
+ // equality operators
200
+ friend bool operator==(const bernoulli_distribution& x, const bernoulli_distribution& y);
201
+
202
  // generating functions
203
  template<class URBG>
204
  result_type operator()(URBG& g);
205
  template<class URBG>
206
  result_type operator()(URBG& g, const param_type& parm);
 
209
  double p() const;
210
  param_type param() const;
211
  void param(const param_type& parm);
212
  result_type min() const;
213
  result_type max() const;
214
+
215
+ // inserters and extractors
216
+ template<class charT, class traits>
217
+ friend basic_ostream<charT, traits>&
218
+ operator<<(basic_ostream<charT, traits>& os, const bernoulli_distribution& x);
219
+ template<class charT, class traits>
220
+ friend basic_istream<charT, traits>&
221
+ operator>>(basic_istream<charT, traits>& is, bernoulli_distribution& x);
222
  };
223
+ }
224
  ```
225
 
226
  ``` cpp
227
  explicit bernoulli_distribution(double p);
228
  ```
 
243
  A `binomial_distribution` random number distribution produces integer
244
  values i ≥ 0 distributed according to the discrete probability function
245
  $$P(i\,|\,t,p) = \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i} \text{ .}$$
246
 
247
  ``` cpp
248
+ namespace std {
249
  template<class IntType = int>
250
  class binomial_distribution {
251
  public:
252
  // types
253
  using result_type = IntType;
 
257
  binomial_distribution() : binomial_distribution(1) {}
258
  explicit binomial_distribution(IntType t, double p = 0.5);
259
  explicit binomial_distribution(const param_type& parm);
260
  void reset();
261
 
262
+ // equality operators
263
+ friend bool operator==(const binomial_distribution& x, const binomial_distribution& y);
264
+
265
  // generating functions
266
  template<class URBG>
267
  result_type operator()(URBG& g);
268
  template<class URBG>
269
  result_type operator()(URBG& g, const param_type& parm);
 
273
  double p() const;
274
  param_type param() const;
275
  void param(const param_type& parm);
276
  result_type min() const;
277
  result_type max() const;
278
+
279
+ // inserters and extractors
280
+ template<class charT, class traits>
281
+ friend basic_ostream<charT, traits>&
282
+ operator<<(basic_ostream<charT, traits>& os, const binomial_distribution& x);
283
+ template<class charT, class traits>
284
+ friend basic_istream<charT, traits>&
285
+ operator>>(basic_istream<charT, traits>& is, binomial_distribution& x);
286
  };
287
+ }
288
  ```
289
 
290
  ``` cpp
291
  explicit binomial_distribution(IntType t, double p = 0.5);
292
  ```
 
315
  A `geometric_distribution` random number distribution produces integer
316
  values i ≥ 0 distributed according to the discrete probability function
317
  $$P(i\,|\,p) = p \cdot (1-p)^{i} \text{ .}$$
318
 
319
  ``` cpp
320
+ namespace std {
321
  template<class IntType = int>
322
  class geometric_distribution {
323
  public:
324
  // types
325
  using result_type = IntType;
 
329
  geometric_distribution() : geometric_distribution(0.5) {}
330
  explicit geometric_distribution(double p);
331
  explicit geometric_distribution(const param_type& parm);
332
  void reset();
333
 
334
+ // equality operators
335
+ friend bool operator==(const geometric_distribution& x, const geometric_distribution& y);
336
+
337
  // generating functions
338
  template<class URBG>
339
  result_type operator()(URBG& g);
340
  template<class URBG>
341
  result_type operator()(URBG& g, const param_type& parm);
 
344
  double p() const;
345
  param_type param() const;
346
  void param(const param_type& parm);
347
  result_type min() const;
348
  result_type max() const;
349
+
350
+ // inserters and extractors
351
+ template<class charT, class traits>
352
+ friend basic_ostream<charT, traits>&
353
+ operator<<(basic_ostream<charT, traits>& os, const geometric_distribution& x);
354
+ template<class charT, class traits>
355
+ friend basic_istream<charT, traits>&
356
+ operator>>(basic_istream<charT, traits>& is, geometric_distribution& x);
357
  };
358
+ }
359
  ```
360
 
361
  ``` cpp
362
  explicit geometric_distribution(double p);
363
  ```
 
382
 
383
  [*Note 1*: This implies that P(i | k,p) is undefined when
384
  `p == 1`. — *end note*]
385
 
386
  ``` cpp
387
+ namespace std {
388
  template<class IntType = int>
389
  class negative_binomial_distribution {
390
  public:
391
  // types
392
  using result_type = IntType;
 
396
  negative_binomial_distribution() : negative_binomial_distribution(1) {}
397
  explicit negative_binomial_distribution(IntType k, double p = 0.5);
398
  explicit negative_binomial_distribution(const param_type& parm);
399
  void reset();
400
 
401
+ // equality operators
402
+ friend bool operator==(const negative_binomial_distribution& x,
403
+ const negative_binomial_distribution& y);
404
+
405
  // generating functions
406
  template<class URBG>
407
  result_type operator()(URBG& g);
408
  template<class URBG>
409
  result_type operator()(URBG& g, const param_type& parm);
 
413
  double p() const;
414
  param_type param() const;
415
  void param(const param_type& parm);
416
  result_type min() const;
417
  result_type max() const;
418
+
419
+ // inserters and extractors
420
+ template<class charT, class traits>
421
+ friend basic_ostream<charT, traits>&
422
+ operator<<(basic_ostream<charT, traits>& os, const negative_binomial_distribution& x);
423
+ template<class charT, class traits>
424
+ friend basic_istream<charT, traits>&
425
+ operator>>(basic_istream<charT, traits>& is, negative_binomial_distribution& x);
426
  };
427
+ }
428
  ```
429
 
430
  ``` cpp
431
  explicit negative_binomial_distribution(IntType k, double p = 0.5);
432
  ```
 
472
  poisson_distribution() : poisson_distribution(1.0) {}
473
  explicit poisson_distribution(double mean);
474
  explicit poisson_distribution(const param_type& parm);
475
  void reset();
476
 
477
+ // equality operators
478
+ friend bool operator==(const poisson_distribution& x, const poisson_distribution& y);
479
+
480
  // generating functions
481
  template<class URBG>
482
  result_type operator()(URBG& g);
483
  template<class URBG>
484
  result_type operator()(URBG& g, const param_type& parm);
 
487
  double mean() const;
488
  param_type param() const;
489
  void param(const param_type& parm);
490
  result_type min() const;
491
  result_type max() const;
492
+
493
+ // inserters and extractors
494
+ template<class charT, class traits>
495
+ friend basic_ostream<charT, traits>&
496
+ operator<<(basic_ostream<charT, traits>& os, const poisson_distribution& x);
497
+ template<class charT, class traits>
498
+ friend basic_istream<charT, traits>&
499
+ operator>>(basic_istream<charT, traits>& is, poisson_distribution& x);
500
  };
501
  ```
502
 
503
  ``` cpp
504
  explicit poisson_distribution(double mean);
 
520
  An `exponential_distribution` random number distribution produces random
521
  numbers x > 0 distributed according to the probability density function
522
  $$p(x\,|\,\lambda) = \lambda e^{-\lambda x} \text{ .}$$
523
 
524
  ``` cpp
525
+ namespace std {
526
  template<class RealType = double>
527
  class exponential_distribution {
528
  public:
529
  // types
530
  using result_type = RealType;
 
534
  exponential_distribution() : exponential_distribution(1.0) {}
535
  explicit exponential_distribution(RealType lambda);
536
  explicit exponential_distribution(const param_type& parm);
537
  void reset();
538
 
539
+ // equality operators
540
+ friend bool operator==(const exponential_distribution& x, const exponential_distribution& y);
541
+
542
  // generating functions
543
  template<class URBG>
544
  result_type operator()(URBG& g);
545
  template<class URBG>
546
  result_type operator()(URBG& g, const param_type& parm);
 
549
  RealType lambda() const;
550
  param_type param() const;
551
  void param(const param_type& parm);
552
  result_type min() const;
553
  result_type max() const;
554
+
555
+ // inserters and extractors
556
+ template<class charT, class traits>
557
+ friend basic_ostream<charT, traits>&
558
+ operator<<(basic_ostream<charT, traits>& os, const exponential_distribution& x);
559
+ template<class charT, class traits>
560
+ friend basic_istream<charT, traits>&
561
+ operator>>(basic_istream<charT, traits>& is, exponential_distribution& x);
562
  };
563
+ }
564
  ```
565
 
566
  ``` cpp
567
  explicit exponential_distribution(RealType lambda);
568
  ```
 
585
  $$p(x\,|\,\alpha,\beta) =
586
  \frac{e^{-x/\beta}}{\beta^{\alpha} \cdot \Gamma(\alpha)} \, \cdot \, x^{\, \alpha-1}
587
  \text{ .}$$
588
 
589
  ``` cpp
590
+ namespace std {
591
  template<class RealType = double>
592
  class gamma_distribution {
593
  public:
594
  // types
595
  using result_type = RealType;
 
599
  gamma_distribution() : gamma_distribution(1.0) {}
600
  explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
601
  explicit gamma_distribution(const param_type& parm);
602
  void reset();
603
 
604
+ // equality operators
605
+ friend bool operator==(const gamma_distribution& x, const gamma_distribution& y);
606
+
607
  // generating functions
608
  template<class URBG>
609
  result_type operator()(URBG& g);
610
  template<class URBG>
611
  result_type operator()(URBG& g, const param_type& parm);
 
615
  RealType beta() const;
616
  param_type param() const;
617
  void param(const param_type& parm);
618
  result_type min() const;
619
  result_type max() const;
620
+
621
+ // inserters and extractors
622
+ template<class charT, class traits>
623
+ friend basic_ostream<charT, traits>&
624
+ operator<<(basic_ostream<charT, traits>& os, const gamma_distribution& x);
625
+ template<class charT, class traits>
626
+ friend basic_istream<charT, traits>&
627
+ operator>>(basic_istream<charT, traits>& is, gamma_distribution& x);
628
  };
629
+ }
630
  ```
631
 
632
  ``` cpp
633
  explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
634
  ```
 
660
  \cdot \left(\frac{x}{b}\right)^{a-1}
661
  \cdot \, \exp\left( -\left(\frac{x}{b}\right)^a\right)
662
  \text{ .}$$
663
 
664
  ``` cpp
665
+ namespace std {
666
  template<class RealType = double>
667
  class weibull_distribution {
668
  public:
669
  // types
670
  using result_type = RealType;
 
674
  weibull_distribution() : weibull_distribution(1.0) {}
675
  explicit weibull_distribution(RealType a, RealType b = 1.0);
676
  explicit weibull_distribution(const param_type& parm);
677
  void reset();
678
 
679
+ // equality operators
680
+ friend bool operator==(const weibull_distribution& x, const weibull_distribution& y);
681
+
682
  // generating functions
683
  template<class URBG>
684
  result_type operator()(URBG& g);
685
  template<class URBG>
686
  result_type operator()(URBG& g, const param_type& parm);
 
690
  RealType b() const;
691
  param_type param() const;
692
  void param(const param_type& parm);
693
  result_type min() const;
694
  result_type max() const;
695
+
696
+ // inserters and extractors
697
+ template<class charT, class traits>
698
+ friend basic_ostream<charT, traits>&
699
+ operator<<(basic_ostream<charT, traits>& os, const weibull_distribution& x);
700
+ template<class charT, class traits>
701
+ friend basic_istream<charT, traits>&
702
+ operator>>(basic_istream<charT, traits>& is, weibull_distribution& x);
703
  };
704
+ }
705
  ```
706
 
707
  ``` cpp
708
  explicit weibull_distribution(RealType a, RealType b = 1.0);
709
  ```
 
729
 
730
  ##### Class template `extreme_value_distribution` <a id="rand.dist.pois.extreme">[[rand.dist.pois.extreme]]</a>
731
 
732
  An `extreme_value_distribution` random number distribution produces
733
  random numbers x distributed according to the probability density
734
+ function[^7]
735
+
736
+ $$p(x\,|\,a,b) = \frac{1}{b}
737
  \cdot \exp\left(\frac{a-x}{b} - \exp\left(\frac{a-x}{b}\right)\right)
738
  \text{ .}$$
739
 
740
  ``` cpp
741
+ namespace std {
742
  template<class RealType = double>
743
  class extreme_value_distribution {
744
  public:
745
  // types
746
  using result_type = RealType;
 
750
  extreme_value_distribution() : extreme_value_distribution(0.0) {}
751
  explicit extreme_value_distribution(RealType a, RealType b = 1.0);
752
  explicit extreme_value_distribution(const param_type& parm);
753
  void reset();
754
 
755
+ // equality operators
756
+ friend bool operator==(const extreme_value_distribution& x,
757
+ const extreme_value_distribution& y);
758
+
759
  // generating functions
760
  template<class URBG>
761
  result_type operator()(URBG& g);
762
  template<class URBG>
763
  result_type operator()(URBG& g, const param_type& parm);
 
767
  RealType b() const;
768
  param_type param() const;
769
  void param(const param_type& parm);
770
  result_type min() const;
771
  result_type max() const;
772
+
773
+ // inserters and extractors
774
+ template<class charT, class traits>
775
+ friend basic_ostream<charT, traits>&
776
+ operator<<(basic_ostream<charT, traits>& os, const extreme_value_distribution& x);
777
+ template<class charT, class traits>
778
+ friend basic_istream<charT, traits>&
779
+ operator>>(basic_istream<charT, traits>& is, extreme_value_distribution& x);
780
  };
781
+ }
782
  ```
783
 
784
  ``` cpp
785
  explicit extreme_value_distribution(RealType a, RealType b = 1.0);
786
  ```
 
820
  }
821
  \text{ .}$$ The distribution parameters μ and σ are also known as this
822
  distribution’s *mean* and *standard deviation*.
823
 
824
  ``` cpp
825
+ namespace std {
826
  template<class RealType = double>
827
  class normal_distribution {
828
  public:
829
  // types
830
  using result_type = RealType;
 
834
  normal_distribution() : normal_distribution(0.0) {}
835
  explicit normal_distribution(RealType mean, RealType stddev = 1.0);
836
  explicit normal_distribution(const param_type& parm);
837
  void reset();
838
 
839
+ // equality operators
840
+ friend bool operator==(const normal_distribution& x, const normal_distribution& y);
841
+
842
  // generating functions
843
  template<class URBG>
844
  result_type operator()(URBG& g);
845
  template<class URBG>
846
  result_type operator()(URBG& g, const param_type& parm);
 
850
  RealType stddev() const;
851
  param_type param() const;
852
  void param(const param_type& parm);
853
  result_type min() const;
854
  result_type max() const;
855
+
856
+ // inserters and extractors
857
+ template<class charT, class traits>
858
+ friend basic_ostream<charT, traits>&
859
+ operator<<(basic_ostream<charT, traits>& os, const normal_distribution& x);
860
+ template<class charT, class traits>
861
+ friend basic_istream<charT, traits>&
862
+ operator>>(basic_istream<charT, traits>& is, normal_distribution& x);
863
  };
864
+ }
865
  ```
866
 
867
  ``` cpp
868
  explicit normal_distribution(RealType mean, RealType stddev = 1.0);
869
  ```
 
894
  $$p(x\,|\,m,s) = \frac{1}{s x \sqrt{2 \pi}}
895
  \cdot \exp{\left(-\frac{(\ln{x} - m)^2}{2 s^2}\right)}
896
  \text{ .}$$
897
 
898
  ``` cpp
899
+ namespace std {
900
  template<class RealType = double>
901
  class lognormal_distribution {
902
  public:
903
  // types
904
  using result_type = RealType;
 
908
  lognormal_distribution() : lognormal_distribution(0.0) {}
909
  explicit lognormal_distribution(RealType m, RealType s = 1.0);
910
  explicit lognormal_distribution(const param_type& parm);
911
  void reset();
912
 
913
+ // equality operators
914
+ friend bool operator==(const lognormal_distribution& x, const lognormal_distribution& y);
915
+
916
  // generating functions
917
  template<class URBG>
918
  result_type operator()(URBG& g);
919
  template<class URBG>
920
  result_type operator()(URBG& g, const param_type& parm);
 
924
  RealType s() const;
925
  param_type param() const;
926
  void param(const param_type& parm);
927
  result_type min() const;
928
  result_type max() const;
929
+
930
+ // inserters and extractors
931
+ template<class charT, class traits>
932
+ friend basic_ostream<charT, traits>&
933
+ operator<<(basic_ostream<charT, traits>& os, const lognormal_distribution& x);
934
+ template<class charT, class traits>
935
+ friend basic_istream<charT, traits>&
936
+ operator>>(basic_istream<charT, traits>& is, lognormal_distribution& x);
937
  };
938
+ }
939
  ```
940
 
941
  ``` cpp
942
  explicit lognormal_distribution(RealType m, RealType s = 1.0);
943
  ```
 
966
  A `chi_squared_distribution` random number distribution produces random
967
  numbers x > 0 distributed according to the probability density function
968
  $$p(x\,|\,n) = \frac{x^{(n/2)-1} \cdot e^{-x/2}}{\Gamma(n/2) \cdot 2^{n/2}} \text{ .}$$
969
 
970
  ``` cpp
971
+ namespace std {
972
  template<class RealType = double>
973
  class chi_squared_distribution {
974
  public:
975
  // types
976
  using result_type = RealType;
 
980
  chi_squared_distribution() : chi_squared_distribution(1.0) {}
981
  explicit chi_squared_distribution(RealType n);
982
  explicit chi_squared_distribution(const param_type& parm);
983
  void reset();
984
 
985
+ // equality operators
986
+ friend bool operator==(const chi_squared_distribution& x, const chi_squared_distribution& y);
987
+
988
  // generating functions
989
  template<class URBG>
990
  result_type operator()(URBG& g);
991
  template<class URBG>
992
  result_type operator()(URBG& g, const param_type& parm);
 
995
  RealType n() const;
996
  param_type param() const;
997
  void param(const param_type& parm);
998
  result_type min() const;
999
  result_type max() const;
1000
+
1001
+ // inserters and extractors
1002
+ template<class charT, class traits>
1003
+ friend basic_ostream<charT, traits>&
1004
+ operator<<(basic_ostream<charT, traits>& os, const chi_squared_distribution& x);
1005
+ template<class charT, class traits>
1006
+ friend basic_istream<charT, traits>&
1007
+ operator>>(basic_istream<charT, traits>& is, chi_squared_distribution& x);
1008
  };
1009
+ }
1010
  ```
1011
 
1012
  ``` cpp
1013
  explicit chi_squared_distribution(RealType n);
1014
  ```
 
1029
  A `cauchy_distribution` random number distribution produces random
1030
  numbers x distributed according to the probability density function
1031
  $$p(x\,|\,a,b) = \left(\pi b \left(1 + \left(\frac{x-a}{b} \right)^2 \, \right)\right)^{-1} \text{ .}$$
1032
 
1033
  ``` cpp
1034
+ namespace std {
1035
  template<class RealType = double>
1036
  class cauchy_distribution {
1037
  public:
1038
  // types
1039
  using result_type = RealType;
 
1043
  cauchy_distribution() : cauchy_distribution(0.0) {}
1044
  explicit cauchy_distribution(RealType a, RealType b = 1.0);
1045
  explicit cauchy_distribution(const param_type& parm);
1046
  void reset();
1047
 
1048
+ // equality operators
1049
+ friend bool operator==(const cauchy_distribution& x, const cauchy_distribution& y);
1050
+
1051
  // generating functions
1052
  template<class URBG>
1053
  result_type operator()(URBG& g);
1054
  template<class URBG>
1055
  result_type operator()(URBG& g, const param_type& parm);
 
1059
  RealType b() const;
1060
  param_type param() const;
1061
  void param(const param_type& parm);
1062
  result_type min() const;
1063
  result_type max() const;
1064
+
1065
+ // inserters and extractors
1066
+ template<class charT, class traits>
1067
+ friend basic_ostream<charT, traits>&
1068
+ operator<<(basic_ostream<charT, traits>& os, const cauchy_distribution& x);
1069
+ template<class charT, class traits>
1070
+ friend basic_istream<charT, traits>&
1071
+ operator>>(basic_istream<charT, traits>& is, cauchy_distribution& x);
1072
  };
1073
+ }
1074
  ```
1075
 
1076
  ``` cpp
1077
  explicit cauchy_distribution(RealType a, RealType b = 1.0);
1078
  ```
 
1105
  \cdot x^{(m/2)-1}
1106
  \cdot \left(1 + \frac{m x}{n}\right)^{-(m + n)/2}
1107
  \text{ .}$$
1108
 
1109
  ``` cpp
1110
+ namespace std {
1111
  template<class RealType = double>
1112
  class fisher_f_distribution {
1113
  public:
1114
  // types
1115
  using result_type = RealType;
 
1119
  fisher_f_distribution() : fisher_f_distribution(1.0) {}
1120
  explicit fisher_f_distribution(RealType m, RealType n = 1.0);
1121
  explicit fisher_f_distribution(const param_type& parm);
1122
  void reset();
1123
 
1124
+ // equality operators
1125
+ friend bool operator==(const fisher_f_distribution& x, const fisher_f_distribution& y);
1126
+
1127
  // generating functions
1128
  template<class URBG>
1129
  result_type operator()(URBG& g);
1130
  template<class URBG>
1131
  result_type operator()(URBG& g, const param_type& parm);
 
1135
  RealType n() const;
1136
  param_type param() const;
1137
  void param(const param_type& parm);
1138
  result_type min() const;
1139
  result_type max() const;
1140
+
1141
+ // inserters and extractors
1142
+ template<class charT, class traits>
1143
+ friend basic_ostream<charT, traits>&
1144
+ operator<<(basic_ostream<charT, traits>& os, const fisher_f_distribution& x);
1145
+ template<class charT, class traits>
1146
+ friend basic_istream<charT, traits>&
1147
+ operator>>(basic_istream<charT, traits>& is, fisher_f_distribution& x);
1148
  };
1149
+ }
1150
  ```
1151
 
1152
  ``` cpp
1153
  explicit fisher_f_distribution(RealType m, RealType n = 1);
1154
  ```
 
1180
  \cdot \frac{\Gamma\big((n+1)/2\big)}{\Gamma(n/2)}
1181
  \cdot \left(1 + \frac{x^2}{n} \right)^{-(n+1)/2}
1182
  \text{ .}$$
1183
 
1184
  ``` cpp
1185
+ namespace std {
1186
  template<class RealType = double>
1187
  class student_t_distribution {
1188
  public:
1189
  // types
1190
  using result_type = RealType;
 
1194
  student_t_distribution() : student_t_distribution(1.0) {}
1195
  explicit student_t_distribution(RealType n);
1196
  explicit student_t_distribution(const param_type& parm);
1197
  void reset();
1198
 
1199
+ // equality operators
1200
+ friend bool operator==(const student_t_distribution& x, const student_t_distribution& y);
1201
+
1202
  // generating functions
1203
  template<class URBG>
1204
  result_type operator()(URBG& g);
1205
  template<class URBG>
1206
  result_type operator()(URBG& g, const param_type& parm);
 
1209
  RealType n() const;
1210
  param_type param() const;
1211
  void param(const param_type& parm);
1212
  result_type min() const;
1213
  result_type max() const;
1214
+
1215
+ // inserters and extractors
1216
+ template<class charT, class traits>
1217
+ friend basic_ostream<charT, traits>&
1218
+ operator<<(basic_ostream<charT, traits>& os, const student_t_distribution& x);
1219
+ template<class charT, class traits>
1220
+ friend basic_istream<charT, traits>&
1221
+ operator>>(basic_istream<charT, traits>& is, student_t_distribution& x);
1222
  };
1223
+ }
1224
  ```
1225
 
1226
  ``` cpp
1227
  explicit student_t_distribution(RealType n);
1228
  ```
 
1251
  known as the *weights* , shall be non-negative, non-NaN, and
1252
  non-infinity. Moreover, the following relation shall hold:
1253
  $0 < S = w_0 + \dotsb + w_{n - 1}$.
1254
 
1255
  ``` cpp
1256
+ namespace std {
1257
  template<class IntType = int>
1258
  class discrete_distribution {
1259
  public:
1260
  // types
1261
  using result_type = IntType;
 
1269
  template<class UnaryOperation>
1270
  discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
1271
  explicit discrete_distribution(const param_type& parm);
1272
  void reset();
1273
 
1274
+ // equality operators
1275
+ friend bool operator==(const discrete_distribution& x, const discrete_distribution& y);
1276
+
1277
  // generating functions
1278
  template<class URBG>
1279
  result_type operator()(URBG& g);
1280
  template<class URBG>
1281
  result_type operator()(URBG& g, const param_type& parm);
 
1284
  vector<double> probabilities() const;
1285
  param_type param() const;
1286
  void param(const param_type& parm);
1287
  result_type min() const;
1288
  result_type max() const;
1289
+
1290
+ // inserters and extractors
1291
+ template<class charT, class traits>
1292
+ friend basic_ostream<charT, traits>&
1293
+ operator<<(basic_ostream<charT, traits>& os, const discrete_distribution& x);
1294
+ template<class charT, class traits>
1295
+ friend basic_istream<charT, traits>&
1296
+ operator>>(basic_istream<charT, traits>& is, discrete_distribution& x);
1297
  };
1298
+ }
1299
  ```
1300
 
1301
  ``` cpp
1302
  discrete_distribution();
1303
  ```
 
1373
  in which the values wₖ, commonly known as the *weights* , shall be
1374
  non-negative, non-NaN, and non-infinity. Moreover, the following
1375
  relation shall hold: 0 < S = w₀ + … + wₙ₋₁.
1376
 
1377
  ``` cpp
1378
+ namespace std {
1379
  template<class RealType = double>
1380
  class piecewise_constant_distribution {
1381
  public:
1382
  // types
1383
  using result_type = RealType;
 
1394
  piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax,
1395
  UnaryOperation fw);
1396
  explicit piecewise_constant_distribution(const param_type& parm);
1397
  void reset();
1398
 
1399
+ // equality operators
1400
+ friend bool operator==(const piecewise_constant_distribution& x,
1401
+ const piecewise_constant_distribution& y);
1402
+
1403
  // generating functions
1404
  template<class URBG>
1405
  result_type operator()(URBG& g);
1406
  template<class URBG>
1407
  result_type operator()(URBG& g, const param_type& parm);
 
1411
  vector<result_type> densities() const;
1412
  param_type param() const;
1413
  void param(const param_type& parm);
1414
  result_type min() const;
1415
  result_type max() const;
1416
+
1417
+ // inserters and extractors
1418
+ template<class charT, class traits>
1419
+ friend basic_ostream<charT, traits>&
1420
+ operator<<(basic_ostream<charT, traits>& os, const piecewise_constant_distribution& x);
1421
+ template<class charT, class traits>
1422
+ friend basic_istream<charT, traits>&
1423
+ operator>>(basic_istream<charT, traits>& is, piecewise_constant_distribution& x);
1424
  };
1425
+ }
1426
  ```
1427
 
1428
  ``` cpp
1429
  piecewise_constant_distribution();
1430
  ```
 
1523
  shall be non-negative, non-NaN, and non-infinity. Moreover, the
1524
  following relation shall hold:
1525
  $$0 < S = \frac{1}{2} \cdot \sum_{k=0}^{n-1} (w_k + w_{k+1}) \cdot (b_{k+1} - b_k) \text{ .}$$
1526
 
1527
  ``` cpp
1528
+ namespace std {
1529
  template<class RealType = double>
1530
  class piecewise_linear_distribution {
1531
  public:
1532
  // types
1533
  using result_type = RealType;
 
1543
  template<class UnaryOperation>
1544
  piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
1545
  explicit piecewise_linear_distribution(const param_type& parm);
1546
  void reset();
1547
 
1548
+ // equality operators
1549
+ friend bool operator==(const piecewise_linear_distribution& x,
1550
+ const piecewise_linear_distribution& y);
1551
+
1552
  // generating functions
1553
  template<class URBG>
1554
  result_type operator()(URBG& g);
1555
  template<class URBG>
1556
  result_type operator()(URBG& g, const param_type& parm);
 
1560
  vector<result_type> densities() const;
1561
  param_type param() const;
1562
  void param(const param_type& parm);
1563
  result_type min() const;
1564
  result_type max() const;
1565
+
1566
+ // inserters and extractors
1567
+ template<class charT, class traits>
1568
+ friend basic_ostream<charT, traits>&
1569
+ operator<<(basic_ostream<charT, traits>& os, const piecewise_linear_distribution& x);
1570
+ template<class charT, class traits>
1571
+ friend basic_istream<charT, traits>&
1572
+ operator>>(basic_istream<charT, traits>& is, piecewise_linear_distribution& x);
1573
  };
1574
+ }
1575
  ```
1576
 
1577
  ``` cpp
1578
  piecewise_linear_distribution();
1579
  ```