randfloat = {
const prng = function* prng(seed) {
if (seed == null) seed = +new Date;
let z, x = 3395989511 ^ seed, y = 1716319410 ^ seed;
while (true) {
x = 62904 * (x & 0xffff) + (x >>> 16);
y = 41874 * (y & 0xffff) + (y >>> 16);
z = (x << 16) + y;
z ^= z >>> 13; z ^= z << 17; z ^= z >>> 5;
yield z;
}
}
const POW_NEG_26 = Math.pow(2, -26);
const POW_NEG_27 = Math.pow(2, -27);
return function* randfloat(seed) {
const p = prng(seed);
while (true) {
const low_bits = p.next().value >>> 6;
const high_bits = p.next().value >>> 5;
yield (high_bits + low_bits * POW_NEG_26) * POW_NEG_27;
}
}
}