cppannotations/yo/stl/geometric.yo
Frank B. Brokken 4d48524f9e WIP
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@498 f6dd340e-d3f9-0310-b409-bdd246841980
2010-12-20 14:40:35 +00:00

47 lines
1.9 KiB
Text

The ti(geometric_distribution<IntType = int>) is used to model the number
of bernoulli trials (cf. ref(BERNOULLI)) needed until the first success.
It has one parameter, tt(prob), representing the probability of success in an
individual bernoulli trial.
Defined types:
verb(
typedef IntType result_type;
struct param_type
{
explicit param_type(double prob = 0.5);
double p() const;
};
)
Constructors, members and example:
itemization(
itt(geometric_distribution<>(double prob = 0.5))
constructs a geometric distribution for bernoulli trials each having
probability tt(prob) of success.
itt(geometric_distribution<>(param_type const &param))
constructs a geometric distribution according to the values stored in
the tt(param) struct.
itt(double p() const)nl()
returns the distribution's tt(prob) parameter;
itt(param_type param() const)nl()
returns the object's tt(param_type) structure;
itt(void param(const param_type &param))
redefines the parameters of the distribution;
itt(result_type min() const)nl()
returns the distribution's lower bound (= tt(0));
itt(result_type max() const)nl()
returns the distribution's upper bound;
itt(template<typename URNG> result_type operator()(URNG &urng))nl()
returns the next random value from the geometric distribution
itt(template<typename URNG> result_type operator())nl()
tt((URNG &urng, param_type &param))nl()
returns the next random value from a geometric distribution
initialized by the provided tt(param) struct.
it() The random number generator that is passed to the generating
functions must return integral values. Here is an example showing how
the geometric distribution can be used:
verbinclude(examples/geometric.cc)
)