summaryrefslogtreecommitdiffstats
path: root/core/math/random_pcg.cpp
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-03-17 19:21:16 +0100
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-03-17 19:21:16 +0100
commit9c518d5f42d3ea15e323d2e99f77db9624f068a8 (patch)
tree692201d0d38a79c838e306f3c7665db319fb6d95 /core/math/random_pcg.cpp
parentfe01776f05b1787b28b4a270d53037a3c25f4ca2 (diff)
downloadredot-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.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) {