summaryrefslogtreecommitdiffstats
path: root/core/math/math_funcs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/math_funcs.cpp')
-rw-r--r--core/math/math_funcs.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp
index ccc463c114..9f5a9c193a 100644
--- a/core/math/math_funcs.cpp
+++ b/core/math/math_funcs.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -29,7 +30,7 @@
#include "math_funcs.h"
#include "core/os/os.h"
-pcg32_random_t Math::default_pcg = { 1, PCG_DEFAULT_INC_64 };
+pcg32_random_t Math::default_pcg = { 12047754176567800795ULL, PCG_DEFAULT_INC_64 };
#define PHI 0x9e3779b9
@@ -50,9 +51,7 @@ void Math::seed(uint64_t x) {
}
void Math::randomize() {
-
- OS::Time time = OS::get_singleton()->get_time();
- seed(OS::get_singleton()->get_ticks_usec() * (time.hour + 1) * (time.min + 1) * (time.sec + 1) * rand()); // TODO: can be simplified.
+ seed(OS::get_singleton()->get_ticks_usec() * default_pcg.state + PCG_DEFAULT_INC_64);
}
uint32_t Math::rand() {