[mlpack-git] master: Handle setting seed properly for Armadillo RNGs past 3.930. (529a281)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:03:53 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit 529a28152f8a034abc9920d8f54778443b960ffc
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed Nov 19 18:52:57 2014 +0000

    Handle setting seed properly for Armadillo RNGs past 3.930.


>---------------------------------------------------------------

529a28152f8a034abc9920d8f54778443b960ffc
 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 1425959..bb4b1f1 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
 }
 
 /**



More information about the mlpack-git mailing list