rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
20 lines • 616 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Mulberry32Generator = void 0;
/**
* @public
* Random number generator.
*/
class Mulberry32Generator {
constructor(seed) {
this.seed = seed;
}
getNext() {
let value = this.seed += 0x6D2B79F5;
value = Math.imul(value ^ value >>> 15, value | 1);
value ^= value + Math.imul(value ^ value >>> 7, value | 61);
return ((value ^ value >>> 14) >>> 0) * 2.3283064365386963e-10;
}
}
exports.Mulberry32Generator = Mulberry32Generator;
//# sourceMappingURL=mulberry-32-generator.js.map