From: uncutstone wu Date: 2006-06-20T02:05:22+09:00 Subject: Re: Is it more convenient to have a random_each in ruby stdl Matthew Smillie wrote: > I agree with you about 'arr.shuffle.each' being better semantically, > but I was worried about efficiency; since the thread started out with > concerns about shuffling really big arrays, I wanted to avoid > creating an intermediate copy of the array. I didn't really think > about it that hard, though, because thinking about it now, I realise > an intermediate copy isn't all that bad (being just references), so > I'm not sure the savings would matter all that much. Yes, since array just stores object references, (0...size).to_a is as large as aArray.dup, they cost same time and space. Best Regards. uncutstone -- Posted via http://www.ruby-forum.com/.