From: Daniel Martin Date: 2006-09-07T06:04:35+09:00 Subject: Re: NArray shuffle "Patrick Hurley" writes: > Has anyone ever needed to "shuffle" an NArray? I can certainly convert > it to an array and do the sort_by {rand} idiom, and then convert it > back. I currently: What about: shuffled = orig[NArray.float(*orig.shape).random!.sort_index] -- s=%q( Daniel Martin -- martin@snowplow.org puts "s=%q(#{s})",s.map{|i|i}[1] ) puts "s=%q(#{s})",s.map{|i|i}[1]