I found this in the archive:
http://thread.gmane.org/gmane.comp.lib.boost.user/26685
I am experiencing the same problem. However it works with
variate_generator - see attached code. Is this simply a documentation
bug which should say `Must always use variate_generator' or are the
distributions supposed to work with any source of randomness? In which
case they don't in 1.35.0 and I will go report it.
Thanks,
Kevin Martin
#include
#include <iostream>
template<typename Randmoness_>void func1(Randmoness_ &r) {
boost::normal_distribution<> x(180, 60);
boost::uniform_real<> X(5.0, 10.0);
std::cout << x(r) << " " << X(r) << std::endl;
}
template<typename Randmoness_>void func2(Randmoness_ &r) {
boost::normal_distribution<> x(180, 60);
boost::variate_generator > y(r, x);
boost::uniform_real<> X(5.0,10.0);
boost::variate_generator >
Y(r, X);
std::cout << y() << " " << Y() << std::endl;
}
int main() {
boost::mt19937 rng;
func1(rng);
func2(rng);
return 0;
}