From Jason Turner

[rand.dist.bern.bernoulli]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp434szjbg/{from.md → to.md} +10 -12
tmp/tmp434szjbg/{from.md → to.md} RENAMED
@@ -1,25 +1,24 @@
1
  ##### Class `bernoulli_distribution` <a id="rand.dist.bern.bernoulli">[[rand.dist.bern.bernoulli]]</a>
2
 
3
  A `bernoulli_distribution` random number distribution produces `bool`
4
- values b distributed according to the discrete probability function $$%
5
- P(b\,|\,p)
6
- = \left\{ \begin{array}{lcl}
7
- p & \mbox{if} & b = \tcode{true} \\
8
- 1-p & \mbox{if} & b = \tcode{false}
9
- \end{array}\right.
10
- \; \mbox{.}$$
11
 
12
  ``` cpp
13
  class bernoulli_distribution {
14
  public:
15
  // types
16
  using result_type = bool;
17
  using param_type = unspecified;
18
 
19
  // constructors and reset functions
20
- explicit bernoulli_distribution(double p = 0.5);
 
21
  explicit bernoulli_distribution(const param_type& parm);
22
  void reset();
23
 
24
  // generating functions
25
  template<class URBG>
@@ -35,17 +34,16 @@ public:
35
  result_type max() const;
36
  };
37
  ```
38
 
39
  ``` cpp
40
- explicit bernoulli_distribution(double p = 0.5);
41
  ```
42
 
43
- *Requires:* 0 ≤ `p` ≤ 1.
44
 
45
- *Effects:* Constructs a `bernoulli_distribution` object; `p` corresponds
46
- to the parameter of the distribution.
47
 
48
  ``` cpp
49
  double p() const;
50
  ```
51
 
 
1
  ##### Class `bernoulli_distribution` <a id="rand.dist.bern.bernoulli">[[rand.dist.bern.bernoulli]]</a>
2
 
3
  A `bernoulli_distribution` random number distribution produces `bool`
4
+ values b distributed according to the discrete probability function
5
+ $$P(b\,|\,p) = \left\{ \begin{array}{ll}
6
+ p & \text{ if $b = \tcode{true}$, or} \\
7
+ 1 - p & \text{ if $b = \tcode{false}$.}
8
+ \end{array}\right.$$
 
 
9
 
10
  ``` cpp
11
  class bernoulli_distribution {
12
  public:
13
  // types
14
  using result_type = bool;
15
  using param_type = unspecified;
16
 
17
  // constructors and reset functions
18
+ bernoulli_distribution() : bernoulli_distribution(0.5) {}
19
+ explicit bernoulli_distribution(double p);
20
  explicit bernoulli_distribution(const param_type& parm);
21
  void reset();
22
 
23
  // generating functions
24
  template<class URBG>
 
34
  result_type max() const;
35
  };
36
  ```
37
 
38
  ``` cpp
39
+ explicit bernoulli_distribution(double p);
40
  ```
41
 
42
+ *Preconditions:* 0 ≤ `p` ≤ 1.
43
 
44
+ *Remarks:* `p` corresponds to the parameter of the distribution.
 
45
 
46
  ``` cpp
47
  double p() const;
48
  ```
49