How can you measure how "shuffled" a deck of cards is?

1.3k Views Asked by At

A few days ago I asked for some methods of measuring how shuffled a deck of cards was. Predictably there were a lot of suggested methods, which got me thinking, which is the best one? I think it'd be a cool experiment to test a bunch of methods, and then compare them. My idea is to start with a sorted deck of cards, and then progressively shuffle it, and after each shuffle calculate how "shuffled" the deck is using a number of methods. I plan to test many different types of shuffles as well, but that's getting into unnecessary detail.

So my question is, what ideas do you have for measuring how shuffled the deck is? I've got a lot of ideas from my previous post, and I'll be throwing in some more basic methods. Here's what I have so far:

  • Calculating the entropy of the deck as described in this wonderful post.
  • Counting the number of pairs in the deck.
  • Counting the number of inversions in the deck after a shuffle.
  • Counting the number of rising or falling sequences in the deck.
  • Tracking the position of each card in the deck and analyzing the change in position after shuffling. Then calculate the entropy of this information. This may have near identical results to the first method, but that's part of the experiment!
  • Recording the number of high and low cards in a series of fixed ranges, and determining the randomness of the shuffle using this data (I don't think I need to go into full detail here but if requested I can give it).

Those are the main methods I have at the moment, but I'm looking for as many as possible. I will be using a program to run all of these, so I can check a nearly unlimited number of methods, of any complexity. So go for it! Give me whatever methods you'd like to see. They can be as easy and flawed as you like (like the 2nd example I gave), or as complicated as you want. The whole idea is to test as many as I can. Also I'm very interested in using entropy, but it's pretty new to me, so any links to methods involving entropy would be fantastic. Once I run the experiment and get the results (in maybe a week or so) I'll update this post with the results I found (lots of pretty graphs to be expected!).

That's the main gist of it, but for some of the more astute of you I'll give a quick explanation for a key issue I found when researching this. A big idea I kept running across is that you don't want to measure the randomness of the shuffled deck, but rather the randomness of the shuffling method itself, checking for a uniform distribution of final deck permutations. However, my objective is to look at a shuffled deck of cards that was originally sorted, and using some method, calculate a quantitative value that represents how shuffled the deck of cards is. The shuffling method itself will be a mystery to the program calculating the randomness (in reality I'll be using a lot of methods from a riffle shuffle to cutting the deck to the Fisher-Yates method). I'm going to look into a lot of statistics on each method like finding the standard deviation or consistency of each one. In the end I'll have a lot of conclusions, but the one I most want to answer is: if handed a shuffled deck that was once sorted, what would be the best method for calculating how well shuffled the deck is? I probably have misunderstood something here so feel free to comment any advice or changes you'd make.

EDIT: I completely forgot to post the results of this test from almost a year ago. The final paper had some very interesting results, and I'd like to show them here. Here is a PDF of the full paper: https://drive.google.com/file/d/1EoJhtHAO5iFjikkH35KDVrmmJQpXVb5q/view?usp=sharing