[mlpack-svn] r11142 - mlpack/trunk/src/mlpack/core/math

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Jan 18 14:07:01 EST 2012


Author: rcurtin
Date: 2012-01-18 14:07:01 -0500 (Wed, 18 Jan 2012)
New Revision: 11142

Modified:
   mlpack/trunk/src/mlpack/core/math/random.hpp
Log:
Add RandomSeed() function to set the random seed, which is always a good time to
be had.


Modified: mlpack/trunk/src/mlpack/core/math/random.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/math/random.hpp	2012-01-18 16:04:34 UTC (rev 11141)
+++ mlpack/trunk/src/mlpack/core/math/random.hpp	2012-01-18 19:07:01 UTC (rev 11142)
@@ -31,6 +31,16 @@
 #endif
 
 /**
+ * Set the random seed used by the random functions (Random() and RandInt()).
+ *
+ * @param seed Seed for the random number generator.
+ */
+inline void RandomSeed(const size_t seed)
+{
+  randGen.seed(seed);
+}
+
+/**
  * Generates a uniform random number between 0 and 1.
  */
 inline double Random()




More information about the mlpack-svn mailing list