From 61b01e0c4012b966ed1b778de9eceaeab238b626 Mon Sep 17 00:00:00 2001 From: Jesse Schwartzentruber Date: Thu, 20 Apr 2017 15:12:31 -0400 Subject: [PATCH] Generate 53-bit floats instead of 32. --- random/mersennetwister.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/random/mersennetwister.js b/random/mersennetwister.js index 67e0422..35ac72f 100644 --- a/random/mersennetwister.js +++ b/random/mersennetwister.js @@ -81,6 +81,6 @@ function MersenneTwister() }; this.real2 = function () { - return this.int32() * (1.0 / 4294967296.0); + return ((this.int32() >>> 5) * 67108864.0 + (this.int32() >>> 6)) / 9007199254740992.0; }; }