diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:44 +0000 |
commit | 17d6a993fc17d533460c5f40f3908c708e057c18 (patch) | |
tree | 1a3bd93e0ecd74fa02f93a528fe2f87e5314c4b5 /src/common/weighted_shuffle.h | |
parent | Releasing progress-linux version 18.2.2-0progress7.99u1. (diff) | |
download | ceph-17d6a993fc17d533460c5f40f3908c708e057c18.tar.xz ceph-17d6a993fc17d533460c5f40f3908c708e057c18.zip |
Merging upstream version 18.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/common/weighted_shuffle.h')
-rw-r--r-- | src/common/weighted_shuffle.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/weighted_shuffle.h b/src/common/weighted_shuffle.h index 10def0a01..dd8f22da0 100644 --- a/src/common/weighted_shuffle.h +++ b/src/common/weighted_shuffle.h @@ -14,6 +14,8 @@ void weighted_shuffle(RandomIt first, RandomIt last, { if (first == last) { return; + } else if (std::accumulate(weight_first, weight_last, 0) == 0) { + return; } else { std::discrete_distribution d{weight_first, weight_last}; if (auto n = d(g); n > 0) { |