title: Sample with replacement in ruby?
body: <p>Following this simple but very convenient method to <a href="https://stackoverflow.com/a/3483802/5783745">sample from an array without replacement</a>, we can see something like</p>
  <pre><code>arr = [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;, &quot;f&quot;]
  arr.sample(10)
  =&gt; [&quot;b&quot;, &quot;a&quot;, &quot;d&quot;, &quot;f&quot;, &quot;e&quot;, &quot;c&quot;]
  </code></pre>
  <p>How is same accomplished, but <em><strong>with replacement</strong></em>? So in the example <code>.sample(10)</code> would return an array of length 10 with some duplicate elements?</p>
  <p>e.g.</p>
  <pre><code>arr = [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;, &quot;f&quot;]
  arr.sample(10)
  =&gt; [&quot;b&quot;, &quot;a&quot;, &quot;d&quot;, &quot;f&quot;, &quot;e&quot;, &quot;c&quot;, &quot;b&quot;, &quot;e&quot;, &quot;a&quot;, &quot;b&quot;]
  </code></pre>