From 3e0b705f60ecdeaddcadc302ae7efcb9ce9f84e8 Mon Sep 17 00:00:00 2001 From: Kahfi Elhady Date: Wed, 11 Mar 2026 08:37:11 +0000 Subject: [PATCH] fix shuffle range bias --- Sorts/BogoSort.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sorts/BogoSort.js b/Sorts/BogoSort.js index eeb4f7feeb..20c5ea8208 100644 --- a/Sorts/BogoSort.js +++ b/Sorts/BogoSort.js @@ -16,7 +16,7 @@ export function isSorted(array) { */ function shuffle(array) { for (let i = array.length - 1; i; i--) { - const m = Math.floor(Math.random() * i) + const m = Math.floor(Math.random() * (i + 1)) const n = array[i - 1] array[i - 1] = array[m] array[m] = n