From 9c518d5f42d3ea15e323d2e99f77db9624f068a8 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:21:16 +0100 Subject: [PATCH] [Core] Fix `rand_weighted` not using the current state The method incorrectly used `Math::randf` instead of `randf` --- core/math/random_pcg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/math/random_pcg.cpp b/core/math/random_pcg.cpp index e0838204949..55787a0b57e 100644 --- a/core/math/random_pcg.cpp +++ b/core/math/random_pcg.cpp @@ -52,7 +52,7 @@ int64_t RandomPCG::rand_weighted(const Vector &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) {