How efficient is it to make a temporary uniform random distribution each time round a loop?
<p>For example:</p>

<pre><code>for (...)
{
    ... std::uniform_real_distribution&lt;float&gt;(min, max)(rng) ...
}
</code></pre>

<p>Intuitively it seems to me that the constructor can't need to do much besides store the two values, and there shouldn't be any state in the uniform_*_distribution instance. I haven't profiled it myself (I'm not at that kind of stage in the project yet), but I felt this question belonged out there :)</p>

<p>I am aware that this would be a bad idea for some distribution types - for example, <code>std::normal_distribution</code> might generate its numbers in pairs, and the second number would be wasted each time.</p>

<p>I feel what I have is more readable than just accessing <code>rng()</code> and doing the maths myself, but I'd be interested if there are any other ways to write this more straightforwardly.</p>