
28 Aug
2010
28 Aug
'10
10:38 a.m.
On Sat, Aug 28, 2010 at 10:49 AM, A Smith
I've abeen recommended on good authority(my son, a Cambridge Pure maths graduate, and Perl/Haskell expert) , and backed by a Google search that Fisher-Yates shuffle is the one to use, as it produces total unbiased results with every combination equally possible. As with most things with computers,don't reinvent the eheel, it's almost certainly been done before by someone brighter that you, Fisher,Yates. & Knuth!
That shuffle requires O(n) time and O(1) space for arrays. Here we're dealing with lists, so either you copy everything between lists and array or use another algorithm. Cheers! -- Felipe.