summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-24 01:19:20 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-24 01:19:20 +0100
commitc258da378b9b297d1df08c8aa2b97301c4b84bc7 (patch)
treea26eb8dfeac339baaafc6ef7f6f3b82ded88c9af
parentaa0e57e00cfaa6c662c1e3c79da29910d385127e (diff)
parent9c518d5f42d3ea15e323d2e99f77db9624f068a8 (diff)
downloadredot-engine-c258da378b9b297d1df08c8aa2b97301c4b84bc7.tar.gz
Merge pull request #89619 from AThousandShips/rand_fix
[Core] Fix `rand_weighted` not using the current state
-rw-r--r--core/math/random_pcg.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/math/random_pcg.cpp b/core/math/random_pcg.cpp
index e083820494..55787a0b57 100644
--- a/core/math/random_pcg.cpp
+++ b/core/math/random_pcg.cpp
@@ -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) {