title: C++11: How to set seed using <random>
body: <p>I am exercising the random library, new to C++11. I wrote the following minimal program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;random&gt;
  using namespace std;
  int main() {
      default_random_engine eng;
      uniform_real_distribution&lt;double&gt; urd(0, 1);
      cout &lt;&lt; "Uniform [0, 1): " &lt;&lt; urd(eng);
  }
  </code></pre>
  
  <p>When I run this repeatedly it gives the same output each time:</p>
  
  <pre><code>&gt;a
  Uniform [0, 1): 0.131538
  &gt;a
  Uniform [0, 1): 0.131538
  &gt;a
  Uniform [0, 1): 0.131538
  </code></pre>
  
  <p>I would like to have the program set the seed differently each time it is called, so that a different random number is generated each time. I am aware that random provides a facility called seed_seq, but I find the explanation of it (at cplusplus.com) totally obscure:</p>
  
  <p><a href="http://www.cplusplus.com/reference/random/seed_seq/" rel="noreferrer">http://www.cplusplus.com/reference/random/seed_seq/</a></p>
  
  <p>I'd appreciate advice on how to have a program generate a new seed each time it is called: The simpler the better.</p>
  
  <p>My platform(s):</p>
  
  <ul>
  <li>Windows 7 : <a href="http://tdm-gcc.tdragon.net/" rel="noreferrer">TDM-GCC compiler</a></li>
  </ul>