Shuffling / Randomisation Logic
Variance Poker uses the Mersenne Twiter Algorithm (MTA) to ensure that shuffling and distribution of cards is fair and just.
Last updated
Variance Poker uses the Mersenne Twiter Algorithm (MTA) to ensure that shuffling and distribution of cards is fair and just.
Last updated
The MTA functions as a (PRNG), producing a sequence of random numbers without any discernible pattern or predictability.
Every random number generator has a couple of parameters to it. The generator is first seeded with a "state" array. In the MTA, this array usually consists of 624 integers. Without going too much into detail (interested readers can learn more ) , readers can takeaway these two key points:
The MTA was carefully designed to be extremely complex, the coupling of the operations ensure that the MTA has a very long period (2^19937 −1, the sequence length before it begins to repeat) and very good statistical properties.
The state array is large, and the dependency of each bit on multiple previous bits helps ensure that the randomness is maintained even over extensive usage.
For those who are interested, you can read more about it .
Random.js provides a set of "engines" for producing random integers, which consistently provide values within [0, 4294967295], i.e. 32 bits of randomness.
nativeMath
: Utilizes and converts its result to a signed integer. This is appropriate to use if you do not care for a deterministic implementation. Based on the implementation (which is hidden to you as a developer), the period may be shorter than expected and start repeating itself.
browserCrypto
: Utilizes . Only supported on newer browsers, but promises cryptographically random numbers.
nodeCrypto
: Utilizes . Only supported on node.
MersenneTwister19937
: An implementation of the algorithm. Not cryptographically secure, but its results are repeatable. Must be seeded with a single integer or an array of integers or call .autoSeed()
to automatically seed initial data. Guaranteed to produce consistent results across all JavaScript implementations assuming the same seed.
In future versions, we have plans to integrate (VRF).