ColorLines: Use AK::shuffle() for shuffling

This commit is contained in:
Sam Atkins 2023-01-20 15:24:29 +00:00 committed by Sam Atkins
parent 5b273f3823
commit 4b525fc98e

View file

@ -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 FisherYates 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()>;