Use Marsaglia's original random number generator.

BUG=316359
LOG=Y
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/80743002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17963 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent bef1cb43
...@@ -174,7 +174,7 @@ function MathRandom() { ...@@ -174,7 +174,7 @@ function MathRandom() {
rngstate[0] = r0; rngstate[0] = r0;
var r1 = (MathImul(36969, rngstate[1] & 0xFFFF) + (rngstate[1] >>> 16)) | 0; var r1 = (MathImul(36969, rngstate[1] & 0xFFFF) + (rngstate[1] >>> 16)) | 0;
rngstate[1] = r1; rngstate[1] = r1;
var x = ((r0 << 14) + (r1 & 0x3FFFF)) | 0; var x = ((r0 << 16) + (r1 & 0xFFFF)) | 0;
// Division by 0x100000000 through multiplication by reciprocal. // Division by 0x100000000 through multiplication by reciprocal.
return (x < 0 ? (x + 0x100000000) : x) * 2.3283064365386962890625e-10; return (x < 0 ? (x + 0x100000000) : x) * 2.3283064365386962890625e-10;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment