This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here’s a 100% deterministic alternative to `Math.random`. Google’s V8 and | |
// Octane benchmark suites use this to ensure predictable results. | |
Math.random = (function() { | |
var seed = 0x2F6E2B1; | |
return function() { | |
// Robert Jenkins’ 32 bit integer hash function | |
seed = ((seed + 0x7ED55D16) + (seed << 12)) & 0xFFFFFFFF; | |
seed = ((seed ^ 0xC761C23C) ^ (seed >>> 19)) & 0xFFFFFFFF; | |
seed = ((seed + 0x165667B1) + (seed << 5)) & 0xFFFFFFFF; |