3 ms·
You don't have to do it for every deck. You can work backwards from a desirable end result. For example, here's a really dumb formula to do a tiny bit better th
by sirclueless 13y ago
You don't have to do it for every deck. You can work backwards from a desirable end result. For example, here's a really dumb formula to do a tiny bit better than random:
The game is "Black or red," where the top card of the deck is revealed. If it is black (clubs or spades), you win. If it is red (hearts or diamonds), the casino wins. The casino can cheat as follows: It generates all 2^32 possible Mersenne "cuts" of the deck. Then it finds those card positions which, through random chance, are shuffled to the top slightly more often by the Mersenne cut process. Then it chooses a deck to reveal as the "shuffled" deck at the beginning with a disproportionately large number of red cards in those locations. Since they will get cut to the top more than 50% of the time, the casino can do more than break even.
The law of large numbers and the fact that MT19937 is a decent PRNG that passes an awful lot of randomness tests says that the chance of each position being "cut" to the top is almost exactly 1/52. So the casino isn't going to do much better than 50% on this game. But the Mersenne twister isn't cryptographically secure at all, you can imagine a casino coming up with a better game that does better than this one at taking advantage of MT-generated permutations.