소스 검색

Cast Unix time to uint in the randomize function

This returns a double while the other values are all uint64_t. The
clang compiler gives a warning since converting the constant to double
loses precision.
George Marques 4 년 전
부모
커밋
7610fc02a0
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      core/math/random_pcg.cpp

+ 1 - 1
core/math/random_pcg.cpp

@@ -39,7 +39,7 @@ RandomPCG::RandomPCG(uint64_t p_seed, uint64_t p_inc) :
 }
 
 void RandomPCG::randomize() {
-	seed((OS::get_singleton()->get_unix_time() + OS::get_singleton()->get_ticks_usec()) * pcg.state + PCG_DEFAULT_INC_64);
+	seed(((uint64_t)OS::get_singleton()->get_unix_time() + OS::get_singleton()->get_ticks_usec()) * pcg.state + PCG_DEFAULT_INC_64);
 }
 
 double RandomPCG::random(double p_from, double p_to) {