title: Best way to seed mt19937_64 for Monte Carlo simulations
body: <p>I'm working on a program that runs Monte Carlo simulation; specifically, I'm using a Metropolis algorithm. The program needs to generate possibly billions of "random" numbers. I know that the Mersenne twister is very popular for Monte Carlo simulation, but I would like to make sure that I am seeding the generator in the best way possible.</p>
  
  <p>Currently I'm computing a 32-bit seed using the following method:</p>
  
  <pre><code>mt19937_64 prng; //pseudo random number generator
  unsigned long seed; //store seed so that every run can follow the same sequence
  unsigned char seed_count; //to help keep seeds from repeating because of temporal proximity
  
  unsigned long genSeed() {
      return (  static_cast&lt;unsigned long&gt;(time(NULL))      &lt;&lt; 16 )
           | ( (static_cast&lt;unsigned long&gt;(clock()) &amp; 0xFF) &lt;&lt; 8  )
           | ( (static_cast&lt;unsigned long&gt;(seed_count++) &amp; 0xFF) );
  }
  
  //...
  
  seed = genSeed();
  prng.seed(seed);
  </code></pre>
  
  <p>I have a feeling there are much better ways to assure non-repeating new seeds, and I'm quite sure mt19937_64 can be seeded with more then 32-bits. Does anyone have any suggestions?</p>