Boost logo

Boost Users :

Subject: [Boost-users] [Random] Bernoulli generalization.
From: Rodolfo Federico Gamarra (rgamarra_at_[hidden])
Date: 2009-01-17 12:32:15


Hi!!

I was working with boost::bernoulli_distribution, and needed a
generalization which instead of receiving a single probability (and
return true/false) would receive N probabilities (adding less than 1)
and would return a whole number in the interval [0 N].

It seems that's usually called "categorial distribution" and that
could be easily implemented, generalizing
boost::bernoulli_distribution.

For now, it seems that the workaround, so to say, is to use a uniform
[0 1] (boost::uniform_01) and then externally to the distro compare
its results with the N probabilities.

Thanks a lot to you all.

--
Rodolfo Federico Gamarra

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net