title: Should I call reset() on my C++ std random distribution to clear hidden state?
body: <p>I would like to wrap the random number distributions from the C++11 standard library with simple functions that take as arguments the distribution's parameters and a generator instance. For example:</p>
  
  <pre><code>double normal(double mean, double sd, std::mt19937_64&amp; generator)
  {
      static std::normal_distribution&lt;double&gt; dist;
      return dist(generator, std::normal_distribution&lt;double&gt;::param_type(mean, sd));
  }
  </code></pre>
  
  <p>I want to avoid any hidden state within the distribution object so that each call to this wrapper function only depends on the given arguments. (Potentially, each call to this function could take a different generator instance.) Ideally, I would make the distribution instance <code>static const</code> to ensure this; however, the distribution's <code>operator()</code> is not a const function, so this isn't possible.</p>
  
  <p>My question is this: To ensure there is no hidden state within the distribution, is it 1) necessary and 2) sufficient to call <code>reset()</code> on the distribution each time? For example:</p>
  
  <pre><code>double normal(double mean, double sd, std::mt19937_64&amp; generator)
  {
      static std::normal_distribution&lt;double&gt; dist;
      dist.reset();
      return dist(generator, std::normal_distribution&lt;double&gt;::param_type(mean, sd));
  }
  </code></pre>
  
  <p>(Overall, I'm confused about the purpose of the <code>reset()</code> function for the random distributions... I understand why the generator would need to be reset/reseeded at times, but why would the distribution object need to be reset?)</p>