diff options
Diffstat (limited to 'extern/ceres/internal/ceres/random.h')
-rw-r--r-- | extern/ceres/internal/ceres/random.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/extern/ceres/internal/ceres/random.h b/extern/ceres/internal/ceres/random.h index 87d9d77d90d..6b280f9ee64 100644 --- a/extern/ceres/internal/ceres/random.h +++ b/extern/ceres/internal/ceres/random.h @@ -34,13 +34,12 @@ #include <cmath> #include <cstdlib> + #include "ceres/internal/port.h" namespace ceres { -inline void SetRandomState(int state) { - srand(state); -} +inline void SetRandomState(int state) { srand(state); } inline int Uniform(int n) { if (n) { @@ -63,7 +62,7 @@ inline double RandNormal() { x1 = 2.0 * RandDouble() - 1.0; x2 = 2.0 * RandDouble() - 1.0; w = x1 * x1 + x2 * x2; - } while ( w >= 1.0 || w == 0.0 ); + } while (w >= 1.0 || w == 0.0); w = sqrt((-2.0 * log(w)) / w); return x1 * w; |