From 4b525fc98e7850ccc4526493b242603d7e28aa69 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 20 Jan 2023 15:24:29 +0000 Subject: [PATCH] ColorLines: Use AK::shuffle() for shuffling --- Userland/Games/ColorLines/MarbleBoard.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Userland/Games/ColorLines/MarbleBoard.h b/Userland/Games/ColorLines/MarbleBoard.h index f5550d69d1..74a4e396a9 100644 --- a/Userland/Games/ColorLines/MarbleBoard.h +++ b/Userland/Games/ColorLines/MarbleBoard.h @@ -62,7 +62,7 @@ public: result.append(point); return IterationDecision::Continue; }); - random_shuffle(result); + shuffle(result); return result; } @@ -336,14 +336,6 @@ private: return true; } - static void random_shuffle(PointArray& points) - { - // Using Fisher–Yates in-place shuffle - if (points.size() > 1) - for (size_t i = points.size() - 1; i > 1; --i) - swap(points[i], points[get_random_uniform(i + 1)]); - } - static constexpr int number_of_marbles_to_remove { 5 }; using Row = Array;