소스 검색

[Core] Fix `rand_weighted` not using the current state

The method incorrectly used `Math::randf` instead of `randf`
A Thousand Ships 1 년 전
부모
커밋
9c518d5f42
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      core/math/random_pcg.cpp

+ 1 - 1
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) {