Discussion about this post

User's avatar
Christopher Jones's avatar

Hi Robin, thanks for looking in and commenting. My shuffling method is addressed here https://bridgecommaoutahead.substack.com/p/how-random-is-it-exactly. Folks who use something other than Javascript have solved this by using a random number generator that can generate an integer large enough to encompass the number of possible deals; they then convert that integer into a deal. You can see that since I only use Javascript, I rely on the window.crypto function that is available to all browsers--but that its degree of entropy is not guaranteed to be high enough for any given purpose. Not wanting to rely on just one call to that function, I call it 52 times and assign the resulting pseudo-random number to each card, then sort the deck on that number. A mathematician might look at that and tell me that using 52 pseudo random numbers does not improve on the potentially low degree of entropy from a single pseudo random number, but as a non-mathematician I did what felt like an improvement on using a single number. Each implementation of window.crypto obtains its seed from some source or other; therefore it varies by browser and possibly by operating system, and I don't control that--I just call window.crypto.getrandomvalues. I would like to know the actual degree of randomness of my method, but of course it's going to vary by platform and implementation of the window.crypto functions.

Expand full comment
Robin Hillyard's avatar

Can you tell me about how you do the shuffle? Do you use the "modified Fisher-Yates" algorithm (also known as Knuth's Algorithm P)? How do you choose the seed?

Expand full comment
5 more comments...

No posts