
I am considering to use boost.random library but have a problem with efficiency. I have a class which provides two public methods: double exponential(double mean) and double getUniform(double min, double max) The implementation I have using boost.random is inefficient and I need some advice in order to improve it. In both the above methods I create a variate_generator object with a mersenne_twister generator and the appropriate distribution. The problem is that the methods are called often which leads to creation and destruction of the variate_generator and the distribution object. I can not store those objects as member variables because the parameters mean in exponential and (min, max) in getUniform varies Thanks in advanced Anakreon