Re: sorting by rand?
- From: Dan Zwell <dzwell@xxxxxxxxx>
- Date: Tue, 1 May 2007 00:55:33 +0900
Marcin Raczkowski wrote:
On Monday 30 April 2007 02:55, Dan Zwell wrote:l = a.length
a.each_index { |x| a[x] = a[rand(l)] }
a.each_index { |x| r= rand(l); a[x], a[r] = a[r], a[x] }
I forgot you could do that. No wonder arrays don't have a swap method!
.
- References:
- Re: sorting by rand?
- From: Peter Seebach
- Re: sorting by rand?
- From: Dan Zwell
- Re: sorting by rand?
- From: Marcin Raczkowski
- Re: sorting by rand?
- Prev by Date: Re: RoR how does scaffold work?
- Next by Date: Re: Ways to change the behavior of a block
- Previous by thread: Re: sorting by rand?
- Next by thread: Re: sorting by rand?
- Index(es):