From: "mame (Yusuke Endoh)" Date: 2012-03-31T10:17:33+09:00 Subject: [ruby-dev:45472] [ruby-trunk - Feature #3647][Feedback] Array#sample(n, replace=false) Issue #3647 has been updated by mame (Yusuke Endoh). Description updated Status changed from Open to Feedback Assignee set to mrkn (Kenta Murata) mrkn さん、 matz の「本当に必要なの」というのに返事と、キーワードの名前の候補出しをお願いします。 -- Yusuke Endoh ---------------------------------------- Feature #3647: Array#sample(n, replace=false) https://bugs.ruby-lang.org/issues/3647#change-25491 Author: mrkn (Kenta Murata) Status: Feedback Priority: Normal Assignee: mrkn (Kenta Murata) Category: core Target version: 2.0.0 =begin 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. =end -- http://bugs.ruby-lang.org/