@mothepro/fancy-p2p
Version:
A quick and efficient way to form p2p groups in the browser
16 lines • 670 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Yields a random integer using Multiply with carry PRNG within [-2 ** 31, 2 ** 31).
* https://en.wikipedia.org/wiki/Multiply-with-carry_pseudorandom_number_generator
*/
function* default_1(seed) {
let multiplier = 987654321;
while (true) {
multiplier = (36969 * (multiplier & 65535 /* SHORT */) + (multiplier >> 16)) & 4294967295 /* INT */;
seed = (18000 * (seed & 65535 /* SHORT */) + (seed >> 16)) & 4294967295 /* INT */;
yield ((multiplier << 16) + seed) & 4294967295 /* INT */;
}
}
exports.default = default_1;
//# sourceMappingURL=random.js.map