From 529a28152f8a034abc9920d8f54778443b960ffc Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 19 Nov 2014 18:52:57 +0000 Subject: [PATCH] Handle setting seed properly for Armadillo RNGs past 3.930. --- src/mlpack/core/math/random.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mlpack/core/math/random.hpp b/src/mlpack/core/math/random.hpp index 1425959f3d..bb4b1f1486 100644 --- a/src/mlpack/core/math/random.hpp +++ b/src/mlpack/core/math/random.hpp @@ -49,6 +49,12 @@ inline void RandomSeed(const size_t seed) { randGen.seed((uint32_t) seed); srand((unsigned int) seed); +#if ARMA_VERSION_MAJOR > 3 || \ + (ARMA_VERSION_MAJOR == 3 && ARMA_VERSION_MINOR >= 930) + // Armadillo >= 3.930 has its own random number generator internally that we + // need to set the seed for also. + arma::arma_rng::set_seed(seed); +#endif } /**