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.

  • Alexstarfire@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 month ago

    No. Either way, you have the same set to pull from and your only pulling one card. The only difference is that generating a card means you don’t have a set order when the first one is pulled.

    If you wanted an equivalent with physical cards you’d pull a card, shuffle the rest, pull another card, repeat until the deck runs out.