From 022cd1a78e471c3bbcd487b258345d73160fcfac Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Mon, 30 Aug 2021 23:02:01 +0200 Subject: [PATCH] Fix table.shuffle off-by-one error --- table.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/table.lua b/table.lua index e934ed6..d51780d 100644 --- a/table.lua +++ b/table.lua @@ -34,7 +34,7 @@ end -- Fisher-Yates function shuffle(table) for index = 1, #table - 1 do - local index_2 = math.random(index + 1, #table) + local index_2 = math.random(index, #table) table[index], table[index_2] = table[index_2], table[index] end return table