As mentioned in this link , you can expand the one-parameter Boost gamma distribution (or TR1) simply by multiplying the rng output on the desired scale.
, variate_generator -, :
#include <boost/random.hpp>
#include <boost/random/gamma_distribution.hpp>
double rgamma( double mean, double variance, boost::mt19937& rng ) {
const double shape = ( mean*mean )/variance;
double scale = variance/mean;
boost::gamma_distribution<> gd( shape );
boost::variate_generator<boost::mt19937&,boost::gamma_distribution<> > var_gamma( rng, gd );
return scale*var_gamma();
}