Here we go again
Shuffling seems to lead people to making a common coding mistake. The
algorithm have been around for decades and I just looked for the one I wrote
in Clipper 15 years ago (thought I might post it) but I couldn't find it.
In any case... fundamentally you have an array which represents all your
cards. You choose a random card between 1 and 52 and swap that card with
the one in the first element of the array. Then you choose a random card
(and this is the important part) from between 2 and 52. You swap this one
with the card in the second element. Then proceed on with 3, 4, 5, etc.
Every card is given a chance to move and each position is filled only once.
There can't be any repeats as the number of remaining cards always
decreases.
Tom