Index: src/math.js |
diff --git a/src/math.js b/src/math.js |
index 29846b05691b877d1ae886259204eba31893b2d2..fc3bf2fcdabf1b4fd5b0083d4b9a219454e388b7 100644 |
--- a/src/math.js |
+++ b/src/math.js |
@@ -5,7 +5,6 @@ |
var rngstate; // Initialized to a Uint32Array during genesis. |
(function(global, utils) { |
- |
"use strict"; |
%CheckIsBootstrapping(); |
@@ -138,6 +137,15 @@ function MathRandom() { |
return (x < 0 ? (x + 0x100000000) : x) * 2.3283064365386962890625e-10; |
} |
+function MathRandomRaw() { |
+ var r0 = (MathImul(18030, rngstate[0] & 0xFFFF) + (rngstate[0] >>> 16)) | 0; |
+ rngstate[0] = r0; |
+ var r1 = (MathImul(36969, rngstate[1] & 0xFFFF) + (rngstate[1] >>> 16)) | 0; |
+ rngstate[1] = r1; |
+ var x = ((r0 << 16) + (r1 & 0xFFFF)) | 0; |
+ return x & 0x3fffffff; |
+} |
+ |
// ECMA 262 - 15.8.2.15 |
function MathRound(x) { |
return %RoundNumber(TO_NUMBER_INLINE(x)); |
@@ -358,6 +366,7 @@ utils.Export(function(to) { |
to.MathAbs = MathAbs; |
to.MathExp = MathExp; |
to.MathFloor = MathFloorJS; |
+ to.IntRandom = MathRandomRaw; |
to.MathMax = MathMax; |
to.MathMin = MathMin; |
}); |