mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-18 10:06:54 +01:00
d84a4013af
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@485 f6dd340e-d3f9-0310-b409-bdd246841980
47 lines
1.9 KiB
Text
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;
|
|
};
|
|
)
|
|
|
|
Constructor, 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 ¶m))
|
|
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 ¶m))
|
|
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 ¶m))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)
|
|
)
|