Maybe automate the stated requirement? (not tested): template<typename D> struct math_to_random{}; template<typename T,typename P> struct math_to_random<math::exponential_distribution<T,P> >{ typedef exponential_distribution<T> type; }; etc. template<typename G,typename T,typename P> variate_generator< G&, math_to_random<math::exponential_distribution<T,P> >::type
make_variate_generator( G& rng, const math::exponential_distribution<T,P>& dist0 ){ typedef typename math_to_random<exponential_distribution<T,P> >::type rd_t; typename variate_generator< G&, rd_t
vg_t;
rd_t rd(dist0.lambda()); return vg_t(rng,dist) } etc. Usage: ... gen; ... vec; math::exponential_distribution<T,P> dist(lambda); std::generate_n( back_inserter(vec), n, make_variate_generator(rng,dist) )