How random is my deck of cards? I play a few card games, and I thought it would be fun to write a card shuffling program, to see how many shuffles it takes to randomize the deck.
The algorithm is:


*

*Cut the deck in the middle ± random offset.

*while one hand is still full, place a small but random number of cards into the second hand in the front/back/both.

*repeat until random.


The question is, how do I check for randomness? I've considered that this might be a 52-spin Ising model, and I can make some function 'cost energy's when they are ordered (ie ace of clubs followed by two of clubs 'cost' more than being next to say the seven of hearts) but this might be overkill...
Is there a mathematical test for randomness I could use here, to check the order of my cards?

If you do a few thousand or tens of thousands of runs of your algorithm, you can look at the distribution of where the first (and each other) card ends up.  It should be reasonably uniform, and the chi-square test can tell you if the unevenness that you see is to be expected.  I would also check how far apart cards that started out together finish.  It looks like your algorithm might not split them apart soon enough.
