Simple (and old :) linear congruential generator with int32 data is used in 2D Ising model at
(WebGL2 is used for int32 textures). But there are better modern algorithms see
. E.g. Algorithm "xor128" from p. 5 of Marsaglia, "Xorshift RNGs" (see wiki). In JavaScript it is
let s = 0, N = 1000000, N1 = 1/N, m =
1/2147483647let state = new Uint32Array([1,2,3,4])
for (let y = 0; y < N; y++){
let t = xorshift128()*m
s += t
}
console.log(s/N)
function xorshift128(){
let s, t = state[3];
state[3] = state[2];
state[2] = state[1];
state[1] = s = state[0];
t ^= t << 11;
t ^= t >> 8;
return state[0] = t ^ s ^ (s >> 19);
}
Evgeny