A shuffled deck of cards is unique in all human history
matthewweathers.com
matthewweathers.com
If the secret police starts breaking down your door, just calmly shuffle the deck. (Don't throw it up in the air; you'd be surprised how much of the deck ordering is maintained during a game of 52-Pickup.)The algorithm is also pretty straightforward. I learned to do it a couple years ago-- if you're interested in crypto and get invited to parties, it makes a neat party trick. It took a couple of hours, maybe, before I could do a couple characters a minute. I'm sure I've forgotten the specifics by now, though; it's not something that comes up a lot in day-to-day life :)
But the shuffling model used in the Diaconis and Bayer paper that the reply referred to (the "7 shuffles to randomize" result) takes that into account. In particular, the shuffling model gives reasonably high probability to "imperfect" riffle shuffles that take several cards from the left pile and then several cards from the right pile.
This model is on the first page of the paper
http://projecteuclid.org/DPubS/Repository/1.0/Disseminate?vi...
Basically, you split the cards at random, and then you draw sequentially at random from the two piles with probability L/(L+R) versus R/(L+R) (where L is the number of cards remaining in the left pile), to assemble the new deck. This will allow shuffle sequences that take a run from the left and then a run from the right.
As people above have noted, of course the "randomization" of the deck is not perfect after 7 shuffles. But for lots of Markov processes, including this one, the distance of the shuffled deck to the uniform distribution on all decks tends to zero exponentially fast. So you get a quick change-over from "not random at all" to "very random". See table 3 of the paper.
Persi Diaconis (http://www-stat.stanford.edu/~cgates/PERSI/), to whom this result is partly due, is a legend in mathematical probability. How many math professors are bona fide magicians?
k 5 6 7 8 9 10
d 0.924 0.624 0.334 0.176 0.085 0.043In particular, we can consider the set:
U = {all permuations that have never been seen by a human}
The counting arguments in the article lead us to conclude that the uniform probability of U is very close to 1, i.e. almost all permuations have never been obtained by a human shuffle. The Bayer-Diaconis result implies that for certain types of shuffles the probability of ending up in U is at least 1 - (the total variation distance above)
So for 8 shuffles, we have a probablity of at least 82.4% of landing in U. This is considerably weaker than "every shuffle is unique".Do you mean to do the cuts one after another?
The only people who use new decks frequently are casinos, and they have very good shuffling machines. It is likely that every deck dealt in a casino is unique.
Without proper shuffling, a card deck is like an encryption key with a poor initialization vector -- it's more predictable.
Card decks ship in order, and playing solitaire will potentially put it back in order. Many people don't shuffle properly, so I would hypothesize that the actual set of decks that most people run into are less random.
Using the same estimate as the OP for n (1.56x10^23) gives p=3.02x10^-22. Still fantastically low.
Related question. If there are exactly 2N people who vote in a binary election (ie: for presidential candidates) and they have an even 50/50% chance of voting either way, how do I compute the odds that they will have a even split? This is a generous estimate for the probability my vote will matter.
Check out: http://en.wikipedia.org/wiki/Binomial_distribution
I think that this is way too low. Shouldn't it be the quite large number
1 - \prod_{i = 1}^n (1 - (i - 1)/52!)
(a la the birthday paradox)?
Mathematica overflowed when I tried to compute this by brute force. The next best thing I can think of is to use the exponential approximation
1 - x ≈ e^{-x},
good for very small `x`, such as ours. Ignoring the cascading errors gives \prod_{i = 1}^n (1 - (i - 1)/52!)
≈ \prod_{i = 1}^n e^{-(i - 1)/52!}
= e^{-n(n - 1)/52!}
≈ 1 - n(n - 1)/52!.
The error should be roughly of the size \frac1 2\sum_{i = 1}^n [(i - 1)/52!]^2
≈ n^3/(2(52!)^2),
which is relatively small. (That's stronger, here, than just saying that it is small.) That is to say: I guess I agree with jgershen after all!http://hatlogic.blogspot.com/2010/04/cards-and-birthdays.htm...
Note that it does not say "If you shuffle a deck of cards, it will be unique in all of human history," which is the argument that the actual article is making.
The article title here is logically equivalent to "Any shuffled deck of cards is unique in all of human history" which is logically equivalent to "No two shuffled decks of cards in human history are equivalent". Therefore, the title of the article as it appears on hacker news needs to be changed
Ignoring the sovereign debt sized hole in the creationist's argument, made obvious by the question "who/what created the creator", my shuffling of a deck of card also results in an almost infinitely unlikely configuration. Despite this, shuffling a deck of card does not make me a god and is quite possible to do without divine intervention.
52! > 2^64
But generator can have states that are not possible to be set directly by seeding (like when generator has for example 1024 bits of state, but can be seeded from 64 bit int). Then period is larger than 2^64, and grand-parent thesis don't hold.
As in, is it taking the birthday paradox into account?
The birthday paradox is the observation that it's much more likely than you'd think that two people in a room share a birthday - which is equivalent to two decks ever having been shuffled into the same order anywhere.
It doesn't make much sense to calculate out that probability on the figures used in the article, since the author has purposefully over-estimated the number of shuffles ever made.
Claim: No two properly shuffled decks have ever been the same.
Proof: For convenience, set upper bound on # of shuffles = n = 10^23 and number of possible shuffles = N = 10^68. Then the probability that all shuffles are not unique is
q = 1 X (1 - 1/N) X (1 - 2/N) X ... X (1 - (n-1)/N).
Since n << N, even (n-1)/N is small, so we can approximate q as
q = 1 X e^(-1/N) X e^(-2/N) X ... X e^(-(n-1)/N) = e^(-n^2/(2N))
using the series expansion e^x = 1 + x for x << 1.
Then the probability that any two decks have ever matched is
p = 1 - q = 1 - e^(-n^2/(2N)).
Now,
q = e^(-5 * 10^(-22)) = 1 - 5 * 10^(-22),
to good approximation, so
p = 1 - q = 5 * 10^(-22)
which is zero for all practical purposes. Thus, no two properly shuffled decks have ever been the same. QED
For example the cards will get wear and tear from constantly being shuffled (especially if you are like me and can't do it well). As the cards get more damaged, they become harder to handle and so becomes harder to shuffle. So less random.. anyone?
The increased grip older cards had, actually improved her ability to shuffle.
http://news.ycombinator.com/item?id=113299