Add mulberry32

This commit is contained in:
kolaflash
2026-01-14 22:00:31 +01:00
parent 38428cf470
commit 9441e09d07
3 changed files with 17 additions and 2 deletions
+12
View File
@@ -0,0 +1,12 @@
/**
* @see https://github.com/cprosche/mulberry32
*/
export function mulberry32(a: number) {
return () => {
a |= 0;
a = (a + 0x6d2b79f5) | 0;
let t = Math.imul(a ^ (a >>> 15), 1 | a);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}