Spaces:
Running
Running
File size: 318 Bytes
1390db3 |
1 2 3 4 5 6 7 8 9 10 11 12 |
// 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;
};
}
|