
A shuffled deck of cards is unique in all human history - pud
http://www.matthewweathers.com/year2006/shuffling_cards.htm
======
efsavage
Makes a good hide-in-plain sight crypto key. I could see James Bond using this
and destroying the key as the bad guys approach with a little 52 pickup.

~~~
jellicle
Done!

<http://www.schneier.com/solitaire.html>

~~~
decklin
In particular,

    
    
        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.)

------
prodigal_erik
See also <http://en.wikipedia.org/wiki/Solitaire_(cipher)> which uses a deck
as an innocent-looking keystream having a lot of entropy.

~~~
eddington
It should be noted Solitaire is not secure for long messages.

<http://www.ciphergoth.org/crypto/solitaire/>

------
lutorm
Nice. But of course, shuffling a deck of cards does not even come close to
completely randomizing the sequence compared to the previous ordering
(especially if you are a crappy shuffler like me). Thus the sequences are
correlated, so it's much more complicated to determine how likely it is to get
a repeated configuration.

~~~
codebaobab
Actually, a deck of card is random after 7 shuffles.

<http://en.wikipedia.org/wiki/Shuffling#Randomization>

~~~
corprew
Actually, I think lutorn's point is that most people (including him) do not do
a full riffle shuffle when they set out to shuffle cards, thus preserving the
order of segments of the cards.

~~~
jfoutz
even if you're preserving blocks of 3, 17! is a big number. it's not 10^44,
but still, 10^14 is pretty big.

~~~
tel
It's a 10 letter password in [a-z]. 8 letter in [A-Za-z]. It's 47 fair coin
flips.

~~~
gaius
I do use the cards metaphor for passwords:
<http://github.com/gaiustech/MkPasswd>

------
Duff
I'd amend this to say "A PROPERLY shuffled deck of cards is unique in all
human history".

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.

~~~
thewisedude
I concur. Another question to think over is...lets say you hand out a brand
new pack of cards which come arranged in a certain order. Now you hand them
out to one million people and ask them to rifle shuffle it 'N' times. What are
the chances that two of them have it stacked in the same way after they do so?
My guess is for low values of 'N', it would not be that uncommon.

------
staktrace
Doesn't the birthday paradox also come into play here, significantly
increasing the chances of a duplicated shuffle?

~~~
chimeracoder
The birthday paradox applies if you are asking about the probability that any
two shuffled decks throughout history have matched each other, not the
probability that a shuffled deck throughout history matches the exact deck you
have in your hands today.

~~~
cq
The title of this article as posted on hacker news is "A shuffled deck of
cards is unique in all human history".

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

~~~
TheSOB88
I don't think it's that important, really

------
BenoitEssiambre
This is also a retort to those who try to say that a universe that supports
human life is too unlikely to happen without a creator.

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.

------
smokinn
Neil Stephenson's excellent book cryptonomicon used this as a means to
facilitate encrypted communication.

------
fberger
Also makes for a great interview question why a pseudo-random generator
initialized with a 64 bit seed will not produce all possible shuffles of a
card deck.

~~~
Confusion
That depends on whether you use the first 52 values after the seed as the
shuffle or are allowed to produce multiple shuffles from the same seed. In the
latter case it also depends on the, unspecified, period of the PRNG.

~~~
ajuc
If the generator memory size is equal to seed size (64 bits), then period
can't be larger than 2^64, and that's probably what grand-parent meant.

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.

------
acron0
I work in the gaming (betting) industry and came across this for the first
time recently. The customer _demanded_ uniform distribution which meant
getting our RNG server to churn out 8 32bit random numbers just to shuffle one
deck. Fun.

------
TomGullen
"When I shuffled the cards this afternoon, and came up with the order you see
in the picture, that is one of 8.0658X1067 different possible orders that
cards can be in. However, in the past 700 years since playing cards were
invented, cards have been shuffled less than 1.546X1023 times. So the chances
that one of those times they got shuffled into the same exact order you see
here are less than 1 in 100000000000000000000000000000000000000000000 (1 in
1044)." I'm too tired to do the math but isn't this wrong?

As in, is it taking the birthday paradox into account?

~~~
mdda
No, this is one fixed example : Akin to someone in the room having exactly
your own birthday.

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.

------
mhartl
An even stronger result takes into account the birthday problem
(<http://en.wikipedia.org/wiki/Birthday_problem>).

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/(2 _N_ ))

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

------
capex
The real world card shuffling is very different. You move multiple cards
together, a few times. I have seen the same pattern of card shuffling being
followed by so many people. Sometimes you arrange the cards in your last game,
and in the next game you exactly know what card is coming up next in case it
didn't change position.

------
sycren
Just wondering but could you say that the more you use a pack of cards, the
less random it is?

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?

~~~
MrJagil
Well, the weak point seems to be "harder to handle = harder to shuffle". I do
not see why that necessarily is the case. My grandmother used to stubbonly
prefer old cards, as newer ones would glide out of her hands.

The increased grip older cards had, actually improved her ability to shuffle.

~~~
sycren
I think if you bent the corner of several cards, depending on how you shuffle
the cards it might affect how random they are.

------
gry
Reminds me of a previous thread. Stacking decks in your Texas Hold'em favor:

    
    
        http://news.ycombinator.com/item?id=113299

------
retube
The analysis presented here assumes proper randomisation of the deck. In
reality this is extremely unlikely as most people are pretty bad shufflers.
Coupled with the fact that decks are manufactured with cards ordered, I bet a
number of card sequences _have_ occurred more than once, and maybe many times.

------
celticjames
Readers may also enjoy this discussion of how many moves a chess player has to
make before he is playing a game unique in human history:

<http://www.radiolab.org/2011/aug/23/rules-set-you-free/>

------
danbmil99
This just in: properly chosen random numbers with lots of bits are probably
unique

------
praptak
Though the number of distinct bridge deals is much smaller, the same is
probably true even for bridge deals. If my math's ok then there's about 2^107
distinct bridge deals, assuming identifiable players.

------
MatthewWeathers
I am Matthew Weathers, the author of the paged referenced here. Thanks for all
the comments and insightful ideas. I've added an update to the page to include
some of the ideas you all have mentioned.

------
comenter
Very nice approach for explaining the randomization! We can conclude one thing
about the article, and the thing is that the perfect shuffle does not matter
that much!

------
epynonymous
nothing like a little combinatorics nostalgia to brighten up your day, best
post today! 52!

