Spaces:
Running
Running
// Seeded pseudo-random number generator (mulberry32) | |
export function makeRandom(seed) { | |
let a = seed >>> 0; | |
return function random() { | |
let t = (a += 0x6D2B79F5); | |
t = Math.imul(t ^ (t >>> 15), t | 1); | |
t ^= t + Math.imul(t ^ (t >>> 7), t | 61); | |
return ((t ^ (t >>> 14)) >>> 0) / 4294967296; | |
}; | |
} | |