in reply to Re^2: swap columns in a 2-dim array
in thread swap columns in a 2-dim array
I meant my alternative reading of the criteria. That of "No column will end up in the same place". Unless I am reading his code wrong, it is possible that a given column could be swapped twice and end up in it's original position.
Indeed, if his Fischer-Yates shuffle is correct, this has to be a possibility in order to meet the fairness criteria. All possible outcomes, including a resultant where the output is in the same ordering as the input have to have equal chance.
I realise that by his original reading, swapping the order of a column twice, so that it ends up back in its original position, meets that criteria. However, the phraseology of the criteria is such, and the nature of the F_Y shuffle such, that explicitely noting it as a criteria made me consider the possibility that my alternative reading might be the true intent.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: swap columns in a 2-dim array
by polettix (Vicar) on Jun 17, 2005 at 12:26 UTC | |
by BrowserUk (Patriarch) on Jun 17, 2005 at 13:08 UTC |