From: Yusuke ENDOH Date: 2011-01-07T22:14:24+09:00 Subject: [ruby-core:34223] Re: [Ruby 1.9-Feature#4247][Open] New features for Array#sample, Array#choice Hi. 2011/1/7 Benoit Daloze : > Did you consider having another option to {each_,}sample to allow replacement ? > Such as: > ary.sample 3, replace: true The word "replace" gives impression of modification, for those who are familiar with programming and not familiar with statistics. Especially, Ruby provides Array#replace. For example, I imagine the following behavior: ary = [1, 2, 3] p ary.sample(replace: true) #=> 1 p ary #=> [2, 3] > Or to follow combinations/permutations: > ary.repeated_sample 3 Hmm. Is each_repeated_sample OK? > Off-topic: > I think it would be nice if some ruby-dev/ruby-core discussions could be merged. > Even if I cannot currently understand Japanese, I can at least read > their "coded" ideas. > I would see that as using the same topic, with both languages. Interesting :-) -- Yusuke Endoh