summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-01-20 15:24:29 +0000
committerSam Atkins <atkinssj@gmail.com>2023-01-20 17:45:33 +0000
commit4b525fc98e7850ccc4526493b242603d7e28aa69 (patch)
tree5802f7371faf6aaf29649d156a44c226f0c15984
parent5b273f3823ece7b0eb4a4a5bf6711bf92a9e3d2d (diff)
downloadserenity-4b525fc98e7850ccc4526493b242603d7e28aa69.zip
ColorLines: Use AK::shuffle() for shuffling
-rw-r--r--Userland/Games/ColorLines/MarbleBoard.h10
1 files changed, 1 insertions, 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<Color, board_size.width()>;