On Monday, April 29, 2002, at 01:03 , Bob Showalter wrote: > May I suggest a modification of the algorithm that avoids this > problem: > > 1. generate a random index from 1 to (number of remaining elements) > 2. use the element at that index > 3. move the last element into the index generated > 4. decrement the number of remaining elements. My complements on a well written analysis of the core algorithm. My concern of course is that since this strategy is destructive of the @array being searched, that one might find it slightly faster to simply slice the array in flight.... http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/randTest.txt ciao drieux ---