@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
20 lines (16 loc) • 345 B
JavaScript
/**
* Excellent 32bit hash function.
*
* Based on work by TheIronBorn circa 2022.
* @param {number} v
* @returns {number}
*/
export function lowbias32(v) {
let x = v;
x ^= x >>> 16;
x = Math.imul(x, 0x21f0aaad);
x ^= x >>> 15;
x = Math.imul(x, 0xd35a2d97)
x ^= x >>> 15;
return x >>> 0;
}