summaryrefslogtreecommitdiffstats
path: root/src/common/weighted_shuffle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/weighted_shuffle.h')
-rw-r--r--src/common/weighted_shuffle.h2
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) {