[mlpack-git] master: Changes code to use mlpack's random object (ad0bf3a)

gitdub at mlpack.org gitdub at mlpack.org
Sun Aug 7 06:21:33 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/4185aa07bbdef80ccdc78a3a3e479499058933db...931ec74894dd2fe0218d0d7dd77fc0ad9be0954d

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

commit ad0bf3a0c545d8596685fcc3343f18fa4a8b6c14
Author: Yannis Mentekidis <mentekid at gmail.com>
Date:   Sun Aug 7 11:21:33 2016 +0100

    Changes code to use mlpack's random object


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

ad0bf3a0c545d8596685fcc3343f18fa4a8b6c14
 src/mlpack/core/dists/gamma_distribution.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/core/dists/gamma_distribution.cpp b/src/mlpack/core/dists/gamma_distribution.cpp
index 85a0933..db9ae38 100644
--- a/src/mlpack/core/dists/gamma_distribution.cpp
+++ b/src/mlpack/core/dists/gamma_distribution.cpp
@@ -206,11 +206,11 @@ arma::vec GammaDistribution::Random() const
 {
   arma::vec randVec(alpha.n_elem);
 
-  std::default_random_engine generator;
   for (size_t d = 0; d < alpha.n_elem; ++d)
   {
     std::gamma_distribution<double> dist(alpha(d), beta(d));
-    randVec(d) = dist(generator);
+    // Use the mlpack random object.
+    randVec(d) = dist(mlpack::math::randGen);
   }
 
   return randVec;




More information about the mlpack-git mailing list