title: How to sample without replacement using c++ uniform_int_distribution
body: <p>I want to use the uniform_int_distribution in the c++ random library. However, it only does the sampling with replacement, as in the example below. How can I sample without replacement?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;random&gt;
  
  int main()
  {
    std::default_random_engine generator;
    std::uniform_int_distribution&lt;int&gt; distribution(1,4);
  
    for(int i=0; i&lt;4; ++i)
      std::cout &lt;&lt; distribution(generator) &lt;&lt; std::endl;
  
    return 0;
  }
  </code></pre>