3 ms·
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:
by vanderZwan 6y 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;
}
- maxgraey 6y ago> To get code blocks you have to indent it with four spaces I'll keep that in mind in next time. Thanks for the tip!
- chrismorgan 6y ago(Technical note: two spaces of indentation is sufficient. Note also how the common leading spaces are not removed.)
- vanderZwan 6y agoAh, thank you!