33
submitted 5 days ago by [email protected] to c/[email protected]

OK, I had a hard time coming up with a single sentence title, so please bear with me.

Let's assume I have a computer with a perfect random number generator. I want to draw from a (electronic) deck of cards that have been shuffled. I can see two distinct algorithms to accomplish this:

  1. Fill a list with the 52 cards in random order, and then pull cards from the list in sequence. That is, defining the (random) sequence of cards before getting them. This is analogous to flipping over cards from a the top of a well-shuffled deck.

  2. Generate a random card from the set that hasn't been selected yet. In other words, you don't keep track of what card is going to come up next, you do a random select each time.

Programattically I can see advantages to both systems, but I'm wondering if there's any mathematical or statistical difference between them.

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 15 points 5 days ago* (last edited 5 days ago)

Assuming I'm understanding your thought experiment correctly, AFAIK, unless the chance of a duplicate card coming up is an issue, it should be about the same.

QI did a bit about this:

The chances that anyone has ever shuffled a pack of cards in the same way twice in the history of the world are infinitesimally small, statistically speaking. The number of possible permutations of 52 cards is '52 factorial' otherwise known as 52! or 52 shriek. This is 52 times 51 times 50 . . . all the way down to one. Here's what that looks like: 80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000.

To give you an idea of how many that is, here is how long it would take to go through every possible permutation of cards. If every star in our galaxy had a trillion planets, each with a trillion people living on them, and each of these people has a trillion packs of cards and somehow they manage to make unique shuffles 1,000 times per second, and they'd been doing that since the Big Bang, they'd only just now be starting to repeat shuffles.

https://www.youtube.com/watch?v=SLIvwtIuC3Y

[-] [email protected] 19 points 5 days ago* (last edited 5 days ago)

There's one quibble about this that might actually alter the answer for OP. Your numbers are correct for purely random shuffles, but a shuffle isn't purely random. A significant number of shuffles begin with a fresh deck where the cards are arranged in order and by suit. And a significant number of shufflers use the same methods, specifically the riffle, the overhand, or some other variant of those.

This is relevant to the field of cryptography, because humans are bad at simulating randomness. If you were to draw the top card from a shuffled deck, you probably have a lower chance of drawing an ace of spades than any other card, simply because the shuffler would not feel like they had shuffled if it was still on top. When picking lotto numbers, people tend to spread out their picks to get a quasi-even distribution across the available numbers, but it's just as likely to come up 1, 2, 3, 4, 5, and 6 as any other combination of numbers. Likewise, people playing with cards tend to cluster suits or pairs together when playing, so you'd be more likely to see those cards in proximity depending on the type of shuffle. Overhand tends to keep clumps together, and riffle or weave tend to interlace the cards in a way that still keeps pairs, sets, and runs close.

Of course, the difference would only be mathematically interesting, since in practice a good few shuffles is certainly close enough to completely random, especially if you start with a previously-shuffled deck. If you were trying to predict a card, your odds on any given draw is still going to be roughly 1 in 52.

[-] [email protected] 5 points 5 days ago

I have seen the QI clip a few times and never thought about this. Very interesting! Thank you for explaining it.

this post was submitted on 23 Sep 2024
33 points (94.6% liked)

Ask Science

8490 readers
28 users here now

Ask a science question, get a science answer.


Community Rules


Rule 1: Be respectful and inclusive.Treat others with respect, and maintain a positive atmosphere.


Rule 2: No harassment, hate speech, bigotry, or trolling.Avoid any form of harassment, hate speech, bigotry, or offensive behavior.


Rule 3: Engage in constructive discussions.Contribute to meaningful and constructive discussions that enhance scientific understanding.


Rule 4: No AI-generated answers.Strictly prohibit the use of AI-generated answers. Providing answers generated by AI systems is not allowed and may result in a ban.


Rule 5: Follow guidelines and moderators' instructions.Adhere to community guidelines and comply with instructions given by moderators.


Rule 6: Use appropriate language and tone.Communicate using suitable language and maintain a professional and respectful tone.


Rule 7: Report violations.Report any violations of the community rules to the moderators for appropriate action.


Rule 8: Foster a continuous learning environment.Encourage a continuous learning environment where members can share knowledge and engage in scientific discussions.


Rule 9: Source required for answers.Provide credible sources for answers. Failure to include a source may result in the removal of the answer to ensure information reliability.


By adhering to these rules, we create a welcoming and informative environment where science-related questions receive accurate and credible answers. Thank you for your cooperation in making the Ask Science community a valuable resource for scientific knowledge.

We retain the discretion to modify the rules as we deem necessary.


founded 1 year ago
MODERATORS