diff --git a/src/js/collection.js b/src/js/collection.js index bbb7ed247b..be6afe0ccf 100644 --- a/src/js/collection.js +++ b/src/js/collection.js @@ -14,7 +14,7 @@ var GlobalMap = global.Map; var GlobalObject = global.Object; var GlobalSet = global.Set; var hashCodeSymbol = utils.ImportNow("hash_code_symbol"); -var IntRandom; +var MathRandom; var MakeTypeError; var MapIterator; var NumberIsNaN; @@ -23,7 +23,7 @@ var speciesSymbol = utils.ImportNow("species_symbol"); var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); utils.Import(function(from) { - IntRandom = from.IntRandom; + MathRandom = from.MathRandom; MakeTypeError = from.MakeTypeError; MapIterator = from.MapIterator; NumberIsNaN = from.NumberIsNaN; @@ -113,7 +113,7 @@ function GetExistingHash(key) { function GetHash(key) { var hash = GetExistingHash(key); if (IS_UNDEFINED(hash)) { - hash = IntRandom() | 0; + hash = (MathRandom() * 0x40000000) | 0; if (hash === 0) hash = 1; SET_PRIVATE(key, hashCodeSymbol, hash); } diff --git a/src/js/math.js b/src/js/math.js index b8deafdee2..c8e8e4ea47 100644 --- a/src/js/math.js +++ b/src/js/math.js @@ -47,14 +47,6 @@ function MathRandom() { return randomNumbers[--nextRandomIndex]; } -function MathRandomRaw() { - if (nextRandomIndex <= kRandomNumberStart) { - randomNumbers = %GenerateRandomNumbers(randomNumbers); - nextRandomIndex = %_TypedArrayGetLength(randomNumbers); - } - return %_DoubleLo(randomNumbers[--nextRandomIndex]) & 0x3FFFFFFF; -} - // ES6 draft 09-27-13, section 20.2.2.28. function MathSign(x) { x = +x; @@ -142,7 +134,7 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [ utils.Export(function(to) { to.MathAbs = MathAbs; - to.IntRandom = MathRandomRaw; + to.MathRandom = MathRandom; }); })