3 ms·
How Not to Shuffle – The Knuth Fisher-Yates Algorithm
- Someone 8y ago”The random number generator is usually only based on 64-bit arithmetic which means it repeats at most after "only" 2⁶⁴” That’s correct for linear congruential generators (https://en.wikipedia.org/wiki/Linear_congruential_generator https://en.wikipedia.org/wiki/Linear_congruential_generator) but not correct in general, and incorrect for RNGs most people will encounter. For example, the Mersenne twister (https://en.wikipedia.org/wiki/Mersenne_Twister https://en.wikipedia.org/wiki/Mersenne_Twister), from 1997, and used in many major software packages, has a period of 2¹⁹⁹³⁷-1.