Chromium Code Reviews| Index: src/math.js |
| diff --git a/src/math.js b/src/math.js |
| index 633a5d02c45d37ef830afbb221c8e5fc5138e08c..95796c636782d53f9ac6c67a2436e4ea88ae3cfd 100644 |
| --- a/src/math.js |
| +++ b/src/math.js |
| @@ -9,6 +9,7 @@ var $exp; |
| var $floor; |
| var $max; |
| var $min; |
| +var $intrandom; |
| (function(global, shared, exports) { |
| @@ -144,6 +145,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)); |
| @@ -361,6 +371,7 @@ $installFunctions(Math, DONT_ENUM, [ |
| $abs = MathAbs; |
| $exp = MathExp; |
| $floor = MathFloorJS; |
| +$intrandom = MathRandomRaw; |
|
adamk
2015/05/21 19:11:32
One more camelCase nit here...$intRandom?
Erik Corry
2015/05/22 06:20:24
Done.
|
| $max = MathMax; |
| $min = MathMin; |