Commit bb0ea1c4 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[foozzie] Make mock for random more expressive

Bug: chromium:1044942
Change-Id: If7caf955f5aab954a57c46aab7830830b1a64d04
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2162872Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67374}
parent 9f856f63
......@@ -8,9 +8,9 @@
// Test foozzie mocks for differential fuzzing.
// Deterministic Math.random.
assertEquals(0.1, Math.random());
assertEquals(0.2, Math.random());
assertEquals(0.3, Math.random());
assertEquals(0.7098480789645691, Math.random());
assertEquals(0.9742682568175951, Math.random());
assertEquals(0.20008059867222983, Math.random());
// Deterministic date.
assertEquals(1477662728698, Date.now());
......
......@@ -14,10 +14,10 @@ var prettyPrinted = function prettyPrinted(msg) { return msg; };
// Mock Math.random.
(function() {
let index = 0
let index = 1;
Math.random = function() {
index = (index + 1) % 10;
return index / 10.0;
const x = Math.sin(index++) * 10000;
return x - Math.floor(x);
}
})();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment