From 8c5118e41dc3cacfe7e5f0ed8a505254e5a6ba3b Mon Sep 17 00:00:00 2001 From: tobspr Date: Tue, 7 Jun 2022 14:16:14 +0200 Subject: [PATCH] Fix randomInt not being evenly distributed --- src/js/core/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/core/utils.js b/src/js/core/utils.js index 1f4bfa05..4a06937d 100644 --- a/src/js/core/utils.js +++ b/src/js/core/utils.js @@ -42,7 +42,7 @@ export function newEmptyMap() { * @param {number} end */ export function randomInt(start, end) { - return start + Math.round(Math.random() * (end - start)); + return Math.floor(Math.random() * (end - start + 1) + start); } /**