Boost logo

Boost Users :

From: kgolod0641 kgolod_at_[hidden])
Date: 2003-02-28 10:31:50


k.t.,

I tried your code and it worked, so I pinpointed my problem to bad
type conversion. Thanks a lot!

Ksenia

--- In Boost-Users_at_[hidden], "k.t." <kohske_at_m...> wrote:
> > Hi,
> >
> > I am using boost_1_29_0 to implement random distribution functions.
> > The standard download included implementation of uniform, normal and
> > exponential distributions - and they work great. I also need an
> > implementation of poisson distribution, and I have noticed that
> > poisson_distribution.hpp was added to CVS last October. I got the
> > file, and put it into the boost/random/ directory, with the other
> > random distribution files.
> >
> > However, when I try using poisson distribution, I get a series of 0's
> > instead of a series of random numbers, although I'm using it exactly
> > the same way as with the other distributions.
> >
> > I am not sure whether the problem is due to incorrect installation of
> > the new file, or due to bugs in the implementation. I tried cleaning
> > the boost_1_29_0 directory, and running bjam again, but still no luck.
> > Is there anything else I should do to include this new header file?
> >
> > Any help would be greatly appreciated.
> >
> > Thank you,
> > Ksenia
>
> In my environment (gcc 3.2 + cygwin.),
> it does work only by including the new header.
>
>
> --exp--
> #include <boost/random.hpp>
> #include <boost/random/poisson_distribution.hpp>
> #include <iostream>
> int main(){
> boost::lagged_fibonacci607 lf;
> boost::poisson_distribution<boost::lagged_fibonacci607> nd(lf,5);
> for(int i=0;i<100;++i)
> std::cout << nd() << ", ";
> std::cout << std::endl;
> }
>
> --result--
> 2, 2, 3, 1, 1, 0, 1, 2, 1, 2, 2, 2, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1, 0, 2,
> 2, 1, 0, 0, 1, 0, 1, 2, 2, 0, 0, 3, 1, 2, 0, 4, 1, 0, 0, 1, 3, 1, 0, 0,
> 1, 1, 1, 0, 2, 0, 0, 1, 0, 1, 0, 2, 0, 2, 1, 3, 1, 1, 1, 1, 0, 1, 1, 1,
> 1, 0, 0, 0, 5, 1, 1, 1, 2, 0, 1, 0, 1, 2, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1,
> 1, 2, 1, 1,
> --
>
> TAKAHASHI, kohske
> kohske_at_m...


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