title: StatsBase.sample() can't draw without replacement if FrequencyWeights() are provided
body: <p>I'm trying to sample without replacement using <code>StatsBase.sample()</code> in Julia. Because I have my data in the following form I can use my counts as <code>FrequencyWeights()</code>:</p>
  <pre><code>using StatsBase
  
  data   = [&quot;red&quot;, &quot;blue&quot;, &quot;green&quot;]
  counts = [2000, 2000, 1]
  
  balls  = StatsBase.sample(data, FrequencyWeights(counts), 1000)
  </code></pre>
  <p>One problem with this is that <code>StatsBase.sample()</code> implicitly sets <code>replace=true</code> so this is possible:</p>
  <pre><code>countmap(balls)
  Dict(&quot;blue&quot;  =&gt; 478,
       &quot;green&quot; =&gt; 2,  # &lt;= two green balls?
       &quot;red&quot;   =&gt; 520)
  </code></pre>
  <p>Explicitly setting <code>replace=false</code> throws an error.</p>
  <pre><code>balls  = StatsBase.sample(data, FrequencyWeights(counts), 1000, replace=false)
  
  Cannot draw 3 samples from 1000 samples without replacement.
  
  error(::String)@error.jl:33
  var&quot;#sample!#174&quot;(::Bool, ::Bool, ::typeof(StatsBase.sample!), ::Random._GLOBAL_RNG, ::Vector{String}, ::StatsBase.FrequencyWeights{Int64, Int64, Vector{Int64}}, ::Vector{String})@sampling.jl:858
  #sample#175@sampling.jl:871[inlined]
  #sample#176@sampling.jl:874[inlined]
  top-level scope@Local: 2[inlined]
  </code></pre>
  <p>Is my only solution here to reformat my data to a wide form like this? Because that seems very inefficient as my actual data set has a lot of counts.:</p>
  <pre><code>wide_data = [fill(&quot;red&quot;, 2000)..., fill(&quot;blue&quot;, 2000)..., &quot;green&quot;]
  sample(wide_data, 1000, replace=false)
  </code></pre>