Boost logo

Boost Users :

Subject: Re: [Boost-users] [random] Cauchy distribution
From: Karsten Ahnert (karsten.ahnert_at_[hidden])
Date: 2011-07-14 12:04:37


> This code should work correctly in 1.47.
> In 1.46 and prior, you need to use variate_generator.
>
> boost::variate_generator<
> boost::mt19937&,
> boost::cauchy_distribution<double> >
> gen(rng, cauchy);
>
> std::cout << gen() << " ";

Ok, thank you. I had the wrong documentation.

Btw. are there any factory functions for the variate_generator?
Something like

make_variate_generator( rng , cauchy )

which could be nicely use when filling containers with random numbers

generate( x.begin() , x.end() ,
          make_variate_generator( rng , cauchy ) );


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