cppannotations/yo/stl/binomial.yo
2010-12-19 10:51:50 +00:00

36 lines
1.3 KiB
Text

The ti(binomial_distribution<IntType = int>) is used to determine the
probability of the number of successes in a sequence of tt(n) independent
success/failure experiments, each of which yields success with probability
tt(p).
The template type parameter tt(IntType) defines the type of the generated
random value, which must be an integral type.
Defined types:
verb(
typedef IntType result_type;
struct param_type
{
explicit param_type(IntType trials, double prob = 0.5);
IntType t() const; // returns trials
double p() const; // returns prob
};
)
Constructors and members and example:
itemization(
itt(binomial_distribution<>(IntType trials = 1, double prob = 0.5))
constructs a binomial distribution for tt(trials) experiments, each
having probability tt(prob) of success.
itt(binomial_distribution<>(param_type const &param))
constructs a binomial distribution according to the values stored in
the tt(param) struct.
itt(IntType t() const)nl()
returns tt(trials);
itt(double p() const)nl()
returns tt(prob);
itt(result_type min() const) nl()
returns 0;
itt(result_type max() const)nl()
returns tt(trials);
)