Talk:Find the missing permutation: Difference between revisions

→‎Perl shuffle: shuffle, reshuffle, and rand
(→‎Perl shuffle: No issues as far as I can see)
(→‎Perl shuffle: shuffle, reshuffle, and rand)
Line 16:
:I wrote that function. I based it closely on the Wikipedia pseudocode, and I was especially careful to avoid fencepost errors. I'm pretty sure it's correct. —[[User:Underscore|Underscore]] ([[User talk:Underscore|Talk]]) 12:56, 24 December 2009 (UTC)
:: I suspect that it was just someone forgetting that every permutation should be equally likely, even the “unlikely” ones. The testing code indicates fairness (or balanced wrongness of course, but I can't conceive of that code doing it). –[[User:Dkf|Donal Fellows]] 13:15, 24 December 2009 (UTC)
::: Heh. I didn't try running several times, so that one result set definitely isn't a representative sample. However I do use that Perl script for a few other things at home (It's great for shuffling things before they get to xargs when doing '''find'''-based playlists). I tried adding a reverse and reshuffle stage (the Knuth shuffle itself sits in its own function), and had elements pop up near the beginning of the list I'd forgotten I'd even had. That suggests to me there's something broken about my Perl implementation's rand function. As the Wp artical mentions, your shuffle quality is limited by your source of random numbers. I'll write a program some time today to do a more representative search and check of the results I noticed. --[[User:Short Circuit|Michael Mol]] 16:05, 24 December 2009 (UTC)
 
== Prototype Tcl Solution ==