title: Why is <random> library producing the same results every time when using std::uniform_int_distribution
body: <p>Notes:</p>
  
  <ol>
  <li>My compiler is g++ 5.1.0-2 with c++14 language standards</li>
  <li>My IDE is Code::Blocks (I tried the code on Dev-C++ too)</li>
  <li>The online IDEs I tested the code on were <a href="http://cpp.sh/" rel="nofollow">http://cpp.sh/</a> (C++ shell) and <a href="https://www.codechef.com/ide" rel="nofollow">https://www.codechef.com/ide</a> (CodeChef.com's IDE) both running c++14</li>
  <li>The code runs ok when using an online IDE, which puzzles me even more.</li>
  </ol>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;random&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  #include &lt;chrono&gt;
  
  int main() {
      srand(time(0));
      long long seed = rand();
      std::default_random_engine rand_num(seed);
      std::uniform_int_distribution&lt;long long&gt; range(0, 10);
      long long a = range(rand_num);
      long long b = rand_num();
      std::cout&lt;&lt;seed&lt;&lt;"\n"; // the seed is different every time (tested)
      std::cout&lt;&lt;a&lt;&lt;"\n";
      std::cout&lt;&lt;b&lt;&lt;"\n";
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>The one with std::uniform_int_distribution (a) isn't random when running the code on my own computer but works ok and creates a random number on the online IDEs.</p>
  
  <p>The one without std::uniform_int_distribution (b) works ok with both online IDEs and my own computer.</p>
  
  <p>What's the problem? How can I fix it?</p>
  
  <p><strong>UPDATE:</strong> The code works ok with mt19937 engine (std::mt19937 and std::mt19937_64)</p>