2 ms·
Here's my favorite deterministic PRNG optimizing for implementation simplicity: function random() { random._s = random._s || 11224; // seed ret
by montroser 2y ago
Here's my favorite deterministic PRNG optimizing for implementation simplicity:
function random() {
random._s = random._s || 11224; // seed
return (random._s = random._s * 16807 % 2147483647) / 2147483646;
}
Wikipedia says this approach has been around at least since the 1950s.
https://en.wikipedia.org/wiki/Linear_congruential_generator https://en.wikipedia.org/wiki/Linear_congruential_generator