ajanata / PretendYoureXyzzy

A web clone of the card game Cards Against Humanity.
https://pretendyoure.xyz/zy
BSD 2-Clause "Simplified" License
1.24k stars 396 forks source link

Card sort RNG seems extremely poor #269

Closed ZeldaZone closed 2 years ago

ZeldaZone commented 2 years ago

I've streamed the game a few times and it's fun, but whether using custom packs or built-in packs, if you use the same combo of card packs, you get extremely similar results. I'm talking the same 30 or so black cards out of over 200. White cards seem to have the same issue, but it's more noticeable with black cards due to how few are played per game.

Can't point to any error codes or exact statistics unfortunately, but me and my group have definitely noticed it and it's a really big buzz kill.

ajanata commented 2 years ago

Decks are shuffled using the standard Java shuffle method. I have noticed that some cards do tend to show up more often than others, but it is still not the same set of cards every time or in the same order every time. Taking a deck of, say, 200 cards, there are 200! (factorial; that is, 200 199 198 197 ... 4 3 2 1) = 7.89e371 (that is, 7 with 371 zeroes after it) different ways to shuffle the deck of cards. A lot of those shuffles will have the same cards show up early, even if it isn't the same card every time.

Maybe using a cryptographically secure RNG instead of the default RNG would help somewhat, but I'm definitely not in maintenance mode for this anymore. If a PR is opened ... maybe it will eventually get merged, but there are several I've not done in years simply because I just don't have the motivation to work on this anymore.