Sorry, but most of these solutions are inelegant and that is because to achieve randomness they require an excessive number of random number calls:
(a) Shuffling the stack by selecting two cards and exchanging requires about 7 times the deck of length to get to nearly random on a 52 deck set, and more on a later deck. It is because you can't ensure that you avoid leaving pairs (do this with a deck of 1,2,3,4 ... etc and shuffle and see how many consecuative pairs you have.
(b) If you loop through the deck index in the forward direction and then swap, you definately want the possibility that a card does not move. BUT this shuffle is flawed. Take a deck of 26 0 + 26 1 in that order ie. 0,0,0,0.....,0,1,1...1 and then shuffle. If you do the shuffle once and then add the first 5 cards you get about 2.55 and 2.45 for the sums as you repeat to an infinite number of tests. [i.e. shuffle the deck, sum, reset the deck] * infinity. That is a significant fraction for a casino to lose. The drift to pure randomness is asymptotic.
(c) Use the algorithm shuffle. Depends on implementation but normally very good
(d) something that is random is this: [ well significantly better than either (a) or (b) ]
int deckIndex[52];
int deck[52];
for(int i=0;i<52;i++)
deckIndex[i]=i;
for(int i=52;i>=1;i--)
{
// ugly: Use a proper random number system e.g
// Mesene Twister. …