Skip to content

Commit c7f3b34

Browse files
author
Colin Robertson
committed
Adding more F1 and TR1 changes
1 parent cd3fa10 commit c7f3b34

13 files changed

+686
-427
lines changed

docs/standard-library/bernoulli-distribution-class.md

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,30 @@ f1_keywords:
1212
- "bernoulli_distribution"
1313
- "std::bernoulli_distribution"
1414
- "random/std::bernoulli_distribution"
15-
- "tr1::bernoulli_distribution"
16-
- "std::tr1::bernoulli_distribution"
17-
- "random/std::tr1::bernoulli_distribution"
15+
- "std::bernoulli_distribution::reset"
16+
- "random/std::bernoulli_distribution::reset"
17+
- "std::bernoulli_distribution::p"
18+
- "random/std::bernoulli_distribution::p"
19+
- "std::bernoulli_distribution::param"
20+
- "random/std::bernoulli_distribution::param"
21+
- "std::bernoulli_distribution::min"
22+
- "random/std::bernoulli_distribution::min"
23+
- "std::bernoulli_distribution::max"
24+
- "random/std::bernoulli_distribution::max"
25+
- "std::bernoulli_distribution::operator()"
26+
- "random/std::bernoulli_distribution::operator()"
27+
- "std::bernoulli_distribution::param_type"
28+
- "random/std::bernoulli_distribution::param_type"
29+
- "std::bernoulli_distribution::param_type::p"
30+
- "random/std::bernoulli_distribution::param_type::p"
31+
- "std::bernoulli_distribution::param_type::operator=="
32+
- "random/std::bernoulli_distribution::param_type::operator=="
33+
- "std::bernoulli_distribution::param_type::operator!="
34+
- "random/std::bernoulli_distribution::param_type::operator!="
1835
dev_langs:
1936
- "C++"
2037
helpviewer_keywords:
2138
- "bernoulli_distribution class"
22-
- "bernoulli_distribution class [TR1]"
2339
ms.assetid: 586bcde1-95ca-411a-bf17-4aaf19482f34
2440
caps.latest.revision: 22
2541
author: "corob-msft"
@@ -44,22 +60,26 @@ translation.priority.ht:
4460
Generates a Bernoulli distribution.
4561

4662
## Syntax
63+
4764
```
4865
class bernoulli_distribution
4966
{
50-
public:
51-
// types
67+
public:
68+
// types
5269
typedef bool result_type;
5370
struct param_type;
54-
// constructors and reset functions
71+
72+
// constructors and reset functions
5573
explicit bernoulli_distribution(double p = 0.5);
5674
explicit bernoulli_distribution(const param_type& parm);
5775
void reset();
76+
5877
// generating functions
5978
template <class URNG>
6079
result_type operator()(URNG& gen);
6180
template <class URNG>
6281
result_type operator()(URNG& gen, const param_type& parm);
82+
6383
// property functions
6484
double p() const;
6585
param_type param() const;
@@ -69,19 +89,32 @@ class bernoulli_distribution
6989
};
7090
```
7191

92+
### Parameters
93+
94+
*URNG*
95+
The uniform random number generator engine. For possible types, see [\<random>](../standard-library/random.md).
96+
7297
## Remarks
73-
The class describes a distribution that produces values of type `bool`, distributed according to the Bernoulli distribution discrete probability function. The following table links to articles about individual members.
98+
The class describes a distribution that produces values of type `bool`, distributed according to the Bernoulli distribution discrete probability function. The following table links to articles about individual members.
7499

75100
||||
76101
|-|-|-|
77102
|[bernoulli_distribution::bernoulli_distribution](#bernoulli_distribution__bernoulli_distribution)|`bernoulli_distribution::p`|`bernoulli_distribution::param`|
78103
|`bernoulli_distribution::operator()`||[bernoulli_distribution::param_type](#bernoulli_distribution__param_type)|
79104

80-
The property member `p()` returns the currently stored distribution parameter value `p`.
105+
The property member `p()` returns the currently stored distribution parameter value `p`.
106+
107+
The property member `param()` sets or returns the `param_type` stored distribution parameter package.
108+
109+
The `min()` and `max()` member functions return the smallest possible result and largest possible result, respectively.
110+
111+
The `reset()` member function discards any cached values, so that the result of the next call to `operator()` does not depend on any values obtained from the engine before the call.
81112

82-
For more information about distribution classes and their members, see [\<random>](../standard-library/random.md).
113+
The `operator()` member functions return the next generated value based on the URNG engine, either from the current parameter package, or the specified parameter package.
83114

84-
For detailed information about the Bernoulli distribution discrete probability function, see the Wolfram MathWorld article [Bernoulli Distribution](http://go.microsoft.com/fwlink/LinkId=398467).
115+
For more information about distribution classes and their members, see [\<random>](../standard-library/random.md).
116+
117+
For detailed information about the Bernoulli distribution discrete probability function, see the Wolfram MathWorld article [Bernoulli Distribution](http://go.microsoft.com/fwlink/LinkId=398467).
85118

86119
## Example
87120

@@ -131,71 +164,65 @@ int main()
131164

132165
test(p_dist, samples);
133166
}
134-
135167
```
136168
137-
## Output
138-
139-
```
169+
```Output
140170
Use CTRL-Z to bypass data entry and run using default values.
141171
Enter a double value for p distribution (where 0.0 <= p <= 1.0): .45
142172
Enter an integer value for a sample count: 100
143173
p == 0.45
144174
Histogram for 100 samples:
145-
false :::::::::::::::::::::::::::::::::::::::::::::::::::::
146-
true :::::::::::::::::::::::::::::::::::::::::::::::
175+
false :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
176+
true :::::::::::::::::::::::::::::::::::::::::
147177
```
148178

149179
## Requirements
150-
**Header:** \<random>
180+
**Header:** \<random>
151181

152-
**Namespace:** std
182+
**Namespace:** std
153183

154184
## <a name="bernoulli_distribution__bernoulli_distribution"></a> bernoulli_distribution::bernoulli_distribution
155-
Constructs the distribution.
185+
Constructs the distribution.
156186

157187
```
158188
explicit bernoulli_distribution(double p = 0.5);
159-
160-
161189
explicit bernoulli_distribution(const param_type& parm);
162190
```
163191

164192
### Parameters
165-
`p`
193+
*p*
166194
The stored `p` distribution parameter.
167195

168-
`parm`
169-
The parameter structure used to construct the distribution.
196+
*parm*
197+
The `param_type` structure used to construct the distribution.
170198

171199
### Remarks
172200
**Precondition:** `0.0 ≤ p ≤ 1.0`
173201

174-
The first constructor constructs an object whose stored `p` value holds the value `p`.
175-
176-
The second constructor constructs an object whose stored parameters are initialized from `parm`. You can obtain and set the current parameters of an existing distribution by calling the `param()` member function.
202+
The first constructor constructs an object whose stored `p` value holds the value *p*.
177203

178-
For more information and a code example, see [binomial_distribution Class](../standard-library/binomial-distribution-class.md).
204+
The second constructor constructs an object whose stored parameters are initialized from *parm*. You can obtain and set the current parameters of an existing distribution by calling the `param()` member function.
179205

180206
## <a name="bernoulli_distribution__param_type"></a> bernoulli_distribution::param_type
181-
Contains the parameters of the distribution.
207+
Contains the parameters of the distribution.
182208

183209
struct param_type {
184210
typedef bernoulli_distribution distribution_type;
185211
param_type(double p = 0.5);
186212
double p() const;
187-
.....
213+
188214
bool operator==(const param_type& right) const;
189215
bool operator!=(const param_type& right) const;
190216
};
191217

192218
### Parameters
193-
See parent topic [bernoulli_distribution Class](../standard-library/bernoulli-distribution-class.md).
219+
*p*
220+
The stored `p` distribution parameter.
194221

195222
### Remarks
196-
**Precondition:** `0.0 ≤ p ≤ 1.0`
223+
**Precondition:** `0.0 ≤ p ≤ 1.0`
197224

198-
This structure can be passed to the distribution's class constructor at instantiation, to the `param()` member function to set the stored parameters of an existing distribution, and to `operator()` to be used in place of the stored parameters.
225+
This structure can be passed to the distribution's class constructor at instantiation, to the `param()` member function to set the stored parameters of an existing distribution, and to `operator()` to be used in place of the stored parameters.
199226

200227
## See Also
201228
[\<random>](../standard-library/random.md)

0 commit comments

Comments
 (0)