Double post removed
Type: Posts; User: pbrockway2
Double post removed
The "seven times" requirement actually applies to riffle-type shuffles where you divide the pack then interleave the two halves. It comes about because the original order is largely preserved by...
A correction: from the OP's code (selecting 1/2 of the pack) I leapt - maybe too fast - to the conclusion he or she was after a riffle shuffle. Anyway the illustration I gave was wrong. It should...
A riffle shuffle doesn't doesn't involve swaps (in any obvious and straight forward sense).
Starting with a pack labelled
0-1-2-3-4-5-6-7-8-9- ... -49-50-51-52
You are attempting to form
...
Norm is right about doing the shuffle "in place" - ie figure out which indices have to swap and use a temporary variable. But what you posted doesn't seem to have anything to do with swapping...