There is an xor-shift based RNG here at http://en.wikipedia.org/wiki/Xorshift with good randomness properties that should be fairly easy to port to JavaScript:
EDIT :
(function () { var x = 123456789; var y = 362436069; var z = 521288629; var w = 88675123; var f = Math.pow(2, -32); Object.defineProperty(Math, 'xor128', { value: function () { var t = x ^ (x << 11); x = y; y = z; z = w; w = w ^ (w >>> 19) ^ (t ^ (t >>> 8)); return (w >>> 0) * f;
Note: only 32 bits out of 128 are used to use the floating point result. Theoretically, you can combine another 20 bits from one of the other state variables to get 52 bits of the result.
The most significant problem with this I see is that it does not support sowing - it will always generate the same sequence.
Alnitak
source share