Skip to content

Commit

Permalink
fix(draw_unique_uniform_values): Use a more fitting algorithm
Browse files Browse the repository at this point in the history
Replace `std::generate` with `std::iota` in
`draw_unique_uniform_values`. It is a more fitting stl algorithm in this
instance.
  • Loading branch information
TomSchammo committed Jan 4, 2024
1 parent 365a37e commit 9826de6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions LidarAug/cpp/include/stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ draw_unique_uniform_values(std::size_t size, std::size_t num_values) {
auto rng = get_rng();

std::vector<T> 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.
Expand Down

0 comments on commit 9826de6

Please sign in to comment.