Random Shuffle?

General discussion about ZunTzu in English.

Moderators: Ichibrothers, Cambronne

Post Reply
Redcap
010
Posts: 56
Joined: 02 Aug 2007, 22:25

Random Shuffle?

Post by Redcap »

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.
User avatar
Jerome
Site Admin
Posts: 974
Joined: 22 Jun 2006, 21:31
Location: France
Contact:

Re: Random Shuffle?

Post by Jerome »

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.
Not true. You were tricked by the animation. Look carefully. :wink:
To avoid giving clues to the players through the way cards move during the shuffle, ZunTzu instantly permutates the cards before the animation starts.
Redcap wrote:I understand that it is nigh well impossible to get a true randomizer from a computer
Well, I suppose it depends on your definition of random. ZunTzu guarantees that the results are both unpredictable and equiprobable.

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.
Redcap
010
Posts: 56
Joined: 02 Aug 2007, 22:25

Post by Redcap »

C'est fantastique

Zun Tzu never ceases to amaze me!
코끼리가 다람쥐를 먹게 하지 마십시오
Post Reply