mc-beta-server/server/mulberry32.ts

10 lines
323 B
TypeScript

// https://stackoverflow.com/a/47593316
// this is good enough (and fast enough) for what i need
export default function mulberry32(a:number) {
return function() {
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;
}
}