diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-03-17 19:21:16 +0100 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-03-17 19:21:16 +0100 |
commit | 9c518d5f42d3ea15e323d2e99f77db9624f068a8 (patch) | |
tree | 692201d0d38a79c838e306f3c7665db319fb6d95 /core/math/random_pcg.cpp | |
parent | fe01776f05b1787b28b4a270d53037a3c25f4ca2 (diff) | |
download | redot-engine-9c518d5f42d3ea15e323d2e99f77db9624f068a8.tar.gz |
[Core] Fix `rand_weighted` not using the current state
The method incorrectly used `Math::randf` instead of `randf`
Diffstat (limited to 'core/math/random_pcg.cpp')
-rw-r--r-- | core/math/random_pcg.cpp | 2 |
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) { |