From c2d7d79b9cfd660c1570c4ca1e056d39c5e91554 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 18 Sep 2021 09:57:26 +0200 Subject: [PATCH] Check random integer generator imputs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmarks/internal/benchmark-utils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/benchmarks/internal/benchmark-utils.js b/benchmarks/internal/benchmark-utils.js index 5579527a..a915a044 100644 --- a/benchmarks/internal/benchmark-utils.js +++ b/benchmarks/internal/benchmark-utils.js @@ -17,7 +17,9 @@ async function runPoolifierTest (pool, { tasks, workerData }) { } function generateRandomInteger (max, min = 0) { + max = Math.floor(max) if (min) { + min = Math.ceil(min) return Math.floor(Math.random() * (max - min + 1)) + min } return Math.floor(Math.random() * (max + 1)) -- 2.34.1