Re: Array#sample is Set#sample and not Array#sample !

2012-06-25 Thread Intransition
On Monday, June 25, 2012 10:53:51 AM UTC-4, Michel Demazure wrote: > > Arrays are ordered, sets are not. Sampling an array should give random > elements in the good order. But : > > irb(main):001:0> (0..10).to_a.sample(5) > => [8, 10, 4, 6, 7] > > Today's Array#sample actually is Set#sample,

Re: Array#sample is Set#sample and not Array#sample !

2012-06-25 Thread Robert Klemme
On Mon, Jun 25, 2012 at 4:53 PM, Michel Demazure wrote: > Arrays are ordered, sets are not. Sampling an array should give random > elements in the good order. But : > > irb(main):001:0> (0..10).to_a.sample(5) > => [8, 10, 4, 6, 7] Where is the problem with that? What do you mean by "good order"?