Random Shuffle?
Moderators: Ichibrothers, Cambronne
Random Shuffle?
I understand that it is nigh well impossible to get a true randomizer from a computer, and Zun Tzu's current shuffle algorithm is great! However when shuffling 2 cards I have noticed that there is absolutley no random element to it at all, the system merely switches the positions of the 1st card with the 2nd card, it may be nice to have a more random effect for shuffling 2 cards, but the uses are not many (just for coin flips or what not) so I would understand if this wasn't a priority.
Re: Random Shuffle?
Not true. You were tricked by the animation. Look carefully.Redcap wrote:when shuffling 2 cards I have noticed that there is absolutley no random element to it at all, the system merely switches the positions of the 1st card with the 2nd card.
To avoid giving clues to the players through the way cards move during the shuffle, ZunTzu instantly permutates the cards before the animation starts.
Well, I suppose it depends on your definition of random. ZunTzu guarantees that the results are both unpredictable and equiprobable.Redcap wrote:I understand that it is nigh well impossible to get a true randomizer from a computer
ZunTzu uses a very high quality pseudorandom number generator called a Mersenne Twister. The results of the number generator are combined with an entropy source based on the movement of the mouse cursors of all players. The movement of the cursors is "whitened" using von Neumann's method. Predicting the result of a die or a shuffle is thus absolutely impossible (if you think of it, the result is even dependent on the variation of the Internet lag between the players and the host!), while all the mathematical qualities of the Mersenne Twister are preserved. All faces of a die have exactly the same probability. And deck permutations are also equiprobable. The colossal period of the Mersenne Twister (4x10^6001) is what allows ZunTzu to correctly shuffle large decks. For instance there's 8x10^67 different ways to shuffle a 52 cards deck. Naive algorithms with periods lower than that number are unable to generate all the possible permutations.
Jerome, ZunTzu developer.