|
Boost : |
From: Hugo Duncan (hugoduncan_at_[hidden])
Date: 2003-08-12 11:48:43
Hi,
Trying to use the new random library on borland gives runtime problems.
The following program below gives a constant result of 85.
I have tracked the problem to variate_generator.hpp, where the internal
engine type is computed
typedef typename random::detail::engine_helper<have_int,
want_int>::BOOST_NESTED_TEMPLATE impl<decorated_engine, typename
Distribution::input_type>::type internal_engine_type;
In the example program it is using uniform_int_float instead of uniform_01
(engine_helper<false,true> instead of engine_helper<true,false>)
I could patch the engine_helper to work using mpl::bool_, but the
dependency is probably not wanted?
Regards,
Hugo
#include "boost/random/mersenne_twister.hpp"
#include "boost/random/normal_distribution.hpp"
#include "boost/random/variate_generator.hpp"
#include <iostream>
int main(int,char**)
{
boost::mt19937 generator;
boost::normal_distribution<> normal_dist(85,88);
boost::variate_generator<boost::mt19937&, boost::normal_distribution<> >
normal(generator, normal_dist);
for (std::size_t i=0;i<100;++i)
std::cout << normal() << std::endl;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk