Hi, At Thu, 16 Dec 2004 07:12:15 +0900, Maarten Boonen wrote in [ruby-talk:123730]: > I made this a function a few days ago and it seems to be a lot faster. > Not sure if it's completely correct though. > > def shuffle! > a = 0 > while(a<length) > b = (length*Kernel.rand).to_i > tmp = self[a] > self[a] = self[b] > self[b] = tmp > a+=1 > end > self > end It wouldn't be uniform. An element which was close to the head will tend to be placed close to the tail. -- Nobu Nakada