diff --git a/src/mlpack/core/math/lin_alg.hpp b/src/mlpack/core/math/lin_alg.hpp index 412a803f07..7452e2ed4b 100644 --- a/src/mlpack/core/math/lin_alg.hpp +++ b/src/mlpack/core/math/lin_alg.hpp @@ -14,6 +14,7 @@ #include #include "ccov.hpp" +#include "random.hpp" /** * Linear algebra utility functions, generally performed on matrices or vectors. diff --git a/src/mlpack/core/math/lin_alg_impl.hpp b/src/mlpack/core/math/lin_alg_impl.hpp index 64cf40df96..1a0408e3c4 100644 --- a/src/mlpack/core/math/lin_alg_impl.hpp +++ b/src/mlpack/core/math/lin_alg_impl.hpp @@ -91,8 +91,8 @@ inline void RandVector(arma::vec& v) for (size_t i = 0; i + 1 < v.n_elem; i += 2) { - double a = Random(); - double b = Random(); + double a = math::Random(); + double b = math::Random(); double first_term = sqrt(-2 * log(a)); double second_term = 2 * M_PI * b; v[i] = first_term * cos(second_term); diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index d756aedabe..3df5caf161 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -40,6 +40,7 @@ #include using namespace mlpack; +using namespace mlpack::math; using namespace mlpack::cf; using namespace mlpack::amf; using namespace mlpack::svd; @@ -202,9 +203,9 @@ PARAM_STRING_IN("neighbor_search", "Algorithm used for neighbor search.", void BINDING_FUNCTION(util::Params& params, util::Timers& timers) { if (params.Get("seed") == 0) - math::RandomSeed(std::time(NULL)); + RandomSeed(std::time(NULL)); else - math::RandomSeed(params.Get("seed")); + RandomSeed(params.Get("seed")); // Validate parameters. RequireOnlyOnePassed(params, { "training", "input_model" }, true);