Patrick Hurley
9/6/2006 6:07:00 PM
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:
na.size.times do
p1,p2 = rand(na.size),rand(na.size)
na[p1],na[p2] = na[p2],na[p1]
end
which works, but I wondering if anyone knew a better way.
Thanks
pth