title: std::default_random_engine generates the same values even with changing seed?
body: <p>I'm trying to implement a class that will serve as sort of a wrapper for the random library so I can use its objects and functions in (I think) a more intuitive way elsewhere in my code. </p>
  
  <p>In my header I have something like this:</p>
  
  <pre><code>class RandomDevice{
  private:
      unsigned long rand_seed;
      default_random_engine engine;
  public:
      RandomDevice(unsigned long n);
      int randInt(int min, int max);};
  </code></pre>
  
  <p>And then in the .cpp file I implement those two functions (constructor and randInt) like so:</p>
  
  <pre><code>RandomDevice::RandomDevice(unsigned long n){
      rand_seed = n;
      default_random_engine engine;
      engine.seed(n);
  }
  
  int RandomDevice::randInt(int min, int max){
      uniform_int_distribution&lt;int&gt; distribution(min, max);
      return distribution(engine);
  }
  </code></pre>
  
  <p>Finally, in my main.cpp I test these functions like this:</p>
  
  <pre><code>int main(){
      unsigned long seed = 1;
      RandomDevice my_rand(seed);
  
      cout &lt;&lt; "random integer: " &lt;&lt; my_rand.randInt(0, 10) &lt;&lt; endl;
  }
  </code></pre>
  
  <p>The problem is, no matter what I set the seed to in main.cpp, I always get the same values for my random numbers (not just randInt, I have other distributions as well). I've also tried setting seed to time(NULL) but the same problem occurs.</p>
  
  <p>I'm really scratching my head at this one. Thanks!</p>