|
|
|
|
|
by vanderZwan
2127 days ago
|
|
Thanks for the tips! (also, as you might have noticed, HN doesn't support MD proper. To get code blocks you have to indent it with four spaces) const eps: f64 = 2.3283064365386963e-10;
const m: u64 = 6364136223846793005;
const inc: u64 = 1442695040888963407;
let state: u64 = 1;
export function random(): f64 {
let oldstate = state * 6364136223846793005 + 1442695040888963407;
state = oldstate;
const xorshifted = u32(((oldstate >>> 18) ^ oldstate) >> 27);
const out_int = rotr(xorshifted, u32(oldstate >> 59));
return eps * out_int;
}
|
|