chore: apply dependencies update
[poolifier.git] / benchmarks / benchmarks-utils.js
index 8bd137a34e3fdbc5a8d8418ac00e097ba251f64f..c04162e1a617d704708b56496040640947e22171 100644 (file)
@@ -31,8 +31,11 @@ function jsonIntegerSerialization (n) {
 }
 
 function generateRandomInteger (max = Number.MAX_SAFE_INTEGER, min = 0) {
+  if (max < min || max < 0 || min < 0) {
+    throw new RangeError('Invalid interval')
+  }
   max = Math.floor(max)
-  if (min != null || min !== 0) {
+  if (min != null && min !== 0) {
     min = Math.ceil(min)
     return Math.floor(Math.random() * (max - min + 1)) + min
   }