[test] Ensure random generator in JSTests does not use float arithmetic
Change-Id: I3530c3f50fdb805d68099108dc33d93abe6bdb39 Bug: v8:8344 Reviewed-on: https://chromium-review.googlesource.com/c/1379931 Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Sigurd Schneider <sigurds@chromium.org> Cr-Commit-Position: refs/heads/master@{#58267}
This commit is contained in:
parent
3ad101f5bf
commit
6720666064
@ -87,6 +87,7 @@ Math.random = (function() {
|
||||
var seed = 49734321;
|
||||
return function() {
|
||||
// Robert Jenkins' 32 bit integer hash function.
|
||||
seed = seed & 0xffffffff;
|
||||
seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
|
||||
seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
|
||||
seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
|
||||
|
@ -136,6 +136,7 @@ Math.random = (function() {
|
||||
var seed = 49734321;
|
||||
return function() {
|
||||
// Robert Jenkins' 32 bit integer hash function.
|
||||
seed = seed & 0xffffffff;
|
||||
seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
|
||||
seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
|
||||
seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
|
||||
|
@ -106,6 +106,7 @@ BenchmarkSuite.ResetRNG = function() {
|
||||
var seed = 49734321;
|
||||
return function() {
|
||||
// Robert Jenkins' 32-bit integer hash function.
|
||||
seed = seed & 0xffffffff;
|
||||
seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
|
||||
seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
|
||||
seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
|
||||
|
@ -60,6 +60,7 @@ function rand() {
|
||||
// To make the test results predictable, we use a 100% deterministic
|
||||
// alternative.
|
||||
// Robert Jenkins' 32 bit integer hash function.
|
||||
seed = seed & 0xffffffff;
|
||||
seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
|
||||
seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
|
||||
seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
|
||||
|
@ -59,6 +59,7 @@ function rand() {
|
||||
// To make the test results predictable, we use a 100% deterministic
|
||||
// alternative.
|
||||
// Robert Jenkins' 32 bit integer hash function.
|
||||
seed = seed & 0xffffffff;
|
||||
seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
|
||||
seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
|
||||
seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
|
||||
|
Loading…
Reference in New Issue
Block a user