Take two desks of cards and shuffle them. They can be standard 52-card decks, though the number of cards in the decks doesn’t matter as long as they’re the same and the decks are fairly large.
Now count the number of times the two desks match, i.e. how many times the same card is in the same position in both desks. The number of matches is random, and its distribution is approximately Poisson with mean 1. Let’s do a simulation and see how close the results come to the predicted outcome.
Here’s the Python code:
import numpy as np from scipy.stats import poisson import matplotlib.pyplot as plt def count_zeros(x): return len(x[x==0]) num_reps = 10000 deck_size = 52 matches = np.zeros(deck_size+1, dtype=int) # Simulation for _ in range(num_reps): # Shuffle two decks a = np.random.permutation(deck_size) b = np.random.permutation(deck_size) # Count how often they match num_matches = count_zeros(a-b) matches[ num_matches ] += 1 # Cut off outputs too small to see cutoff = 8 # Matches predicted by a Poisson distribution with mean 1. predicted = [num_reps*poisson(1).pmf(i) for i in range(cutoff)] # Plot results x = np.arange(cutoff) w = 0.3 # bar width plt.bar(x, matches[0:cutoff], w) plt.bar(x+w, predicted, w) plt.legend(["actual", "predicted"]) plt.xlabel("matches") plt.ylabel("frequency") plt.savefig("shuffled_desk_matches.svg") plt.show()
And here’s the output based on 10,000 simulations:
About 1/3 of the time, you get no matches, another 1/3 of the time you get one match, and the rest of the time you get more. More precisely, according to the Poisson model zero matches and one match are both have probability 1/e.