From 9826de60a70c7a3dad7ce405ac578f41f1c518d1 Mon Sep 17 00:00:00 2001 From: Tom Schammo Date: Thu, 4 Jan 2024 12:25:35 +0100 Subject: [PATCH] fix(draw_unique_uniform_values): Use a more fitting algorithm Replace `std::generate` with `std::iota` in `draw_unique_uniform_values`. It is a more fitting stl algorithm in this instance. --- LidarAug/cpp/include/stats.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LidarAug/cpp/include/stats.hpp b/LidarAug/cpp/include/stats.hpp index 745efa0..444e6d0 100644 --- a/LidarAug/cpp/include/stats.hpp +++ b/LidarAug/cpp/include/stats.hpp @@ -116,8 +116,7 @@ draw_unique_uniform_values(std::size_t size, std::size_t num_values) { auto rng = get_rng(); std::vector values(size); - std::generate(values.begin(), values.end(), - [value = 0]() mutable { return value++; }); + std::iota(values.begin(), values.end(), 0); // TODO(tom): `sample` would work as well I think. It would replace the // `shuffle` + `resize`, but the `generate` still stays.