Closed toddmedema closed 2 months ago
Based on https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript it sounds like I can just use this function:
function splitmix32(a) {
return function() {
a |= 0;
a = a + 0x9e3779b9 | 0;
let t = a ^ a >>> 16;
t = Math.imul(t, 0x21f0aaad);
t = t ^ t >>> 15;
t = Math.imul(t, 0x735a2d97);
return ((t = t ^ t >>> 15) >>> 0) / 4294967296;
}
}
const prng = splitmix32(Date.now() * Math.random())
for(let i=0; i<10; i++) console.log(prng());