Fix RandomPCG::rand_weighted incorrectly returning -1

(cherry picked from commit ab13513403)
This commit is contained in:
Togira
2024-07-03 12:58:24 +02:00
committed by Rémi Verschelde
parent e2184c5da0
commit c4351c8d98

View File

@ -60,6 +60,11 @@ int64_t RandomPCG::rand_weighted(const Vector<float> &p_weights) {
}
}
for (int64_t i = weights_size - 1; i >= 0; --i) {
if (weights[i] > 0) {
return i;
}
}
return -1;
}