4 ms·
Using 32 cards to get 5 bits of entropy only works if you are randomly selecting a single card at a time. If you shuffle a deck of 32 cards, you get ~117 bits,
by klodolph 8y ago
Using 32 cards to get 5 bits of entropy only works if you are randomly selecting a single card at a time.
If you shuffle a deck of 32 cards, you get ~117 bits, a fair bit less that the 160 bits you would get for 5 bits/card, and there's extra math.
- nickpsecurity 8y agoI shuffled a full deck multiple times, no less than five, before using cards in order ignoring any but the 32. I know shuffling all the cards adds randomness vs just shuffling 32. I do want to know why you say two things: 1. 32 = 117 bits of entropy, not 150, after lots of shuffling. 2. It works if I randomly select a single card at a time but not in order from a randomized deck. In order from a randomized deck should give the entropy amount or close to it. I'm not a probability expert. Just doing what I could with good, shuffling skills. Good enough that people refused to play Spades with decks I shuffled. So, I thought I had good entropy. I'm always up for improvements.
- klodolph 8y agoThe first card you draw can be any one of 32 cards. This gives you 5 bits of entropy. The second card can be any one of 31 cards, because it can't be the same as the first card. This gives you log2 31 = ~4.95 bits of entropy. If this argument isn’t convincing, think of it this way. If you draw two cards, then there are 32 choose 2 cards you can draw, and 32 choose 2 is 496, giving log2(496) = ~8.95 bits. You can draw them in two different orders, giving 1 extra bit, total of ~9.95. If you could draw a pair of the same card, there are 32 different pairs to draw, giving (496 * 2) + 32 possibilities, which is 1024, and log2 1024 = 10. But you can't draw a pair of the same card. Or for another argument, consider that there are 32! different ways to shuffle the deck with 32 cards. log2 32! = ~117.