Feature #3647: Array#sample(n, replace=false)
http://redmine.ruby-lang.org/issues/show/3647
e$B5/I<<Te(B: Kenta M.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: core, Target version: 1.9.x
Array#sample does not support sampling with replacement directly, so we
must write codes like the following to obtain samples with replacement.
samples_with_replacement = n.times.map { source.sample }
If Array#sample has the argument for switching with/without replacement,
we can write it as follow.
samples_with_replacement = source.sample(n, true)
The patch was attached. Please consider to merge.