Merge pull request #89619 from AThousandShips/rand_fix

[Core] Fix `rand_weighted` not using the current state
This commit is contained in:
Rémi Verschelde 2024-03-24 01:19:20 +01:00
commit c258da378b
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 1 additions and 1 deletions

View File

@ -52,7 +52,7 @@ int64_t RandomPCG::rand_weighted(const Vector<float> &p_weights) {
weights_sum += weights[i];
}
float remaining_distance = Math::randf() * weights_sum;
float remaining_distance = randf() * weights_sum;
for (int64_t i = 0; i < weights_size; ++i) {
remaining_distance -= weights[i];
if (remaining_distance < 0) {