title: Performance issue with random double generation using Mersenne twister
body: <p>I have the following code:</p>
  
  <pre><code>//#include all necessary things
  class RandomGenerator {
  public:
     double GetRandomDbl() {
       random_device rd;
       mt19937 eng(rd());
       std::uniform_real_distribution&lt;double&gt; dDistribution(0,1);
       return dDistribution(eng);
       }
   };
  </code></pre>
  
  <p>And then I have:</p>
  
  <pre><code>int _tmain(int argc, _TCHAR* argv[])
  {
  RandomGenerator Rand;    //on the heap for now
  
  for (int i = 0; i &lt; 1000000; i++) {
  double pF = Rand.GetRandomDbl();
  }
  }
  </code></pre>
  
  <p>This code alone, takes an astounding 25-28 seconds to execute on 4GB RAM. I recall reading something about instantiating a new object every time I use the Mersenne twister, but if that's the issue how should I improve this? Surely this can be made faster.</p>