From: Jérôme Benoit Date: Sat, 18 Sep 2021 07:57:26 +0000 (+0200) Subject: Check random integer generator imputs X-Git-Tag: v2.2.0~23 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c2d7d79b9cfd660c1570c4ca1e056d39c5e91554;p=poolifier.git Check random integer generator imputs Signed-off-by: Jérôme Benoit --- 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))