[mlpack-svn] [MLPACK] #193: Random number generator has fixed seed

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Thu Jan 26 16:11:15 EST 2012


#193: Random number generator has fixed seed
-------------------------+--------------------------------------------------
 Reporter:  pram         |        Owner:                                       
     Type:  enhancement  |       Status:  new                                  
 Priority:  major        |    Milestone:                                       
Component:  mlpack       |     Keywords:  Random number generator, mlpack::math
 Blocking:               |   Blocked By:                                       
-------------------------+--------------------------------------------------
 The random number generator `mlpack::math::RandInt(lo, hiExclusive)`
 produces the same set of numbers for a fixed value of `lo` and
 `hiExclusive`. I tried using `srand(time(NULL))` but that does not seem to
 affect the result.

 The example code to see this behavior is in
 {{{contrib/pram/test/testRand.cpp}}}

 For `lo = 0` and `hiExclusive = 100`, the following is the result:
 {{{

 [pram at no build]$ ./test/rand_test
 [DEBUG] Compiled with debugging symbols.
 74, 14, 47, 92, 88
 [pram at no build]$ ./test/rand_test
 [DEBUG] Compiled with debugging symbols.
 74, 14, 47, 92, 88
 [pram at no build]$ ./test/rand_test
 [DEBUG] Compiled with debugging symbols.
 74, 14, 47, 92, 88
 [pram at no build]$ ./test/rand_test
 [DEBUG] Compiled with debugging symbols.
 74, 14, 47, 92, 88
 [pram at no build]$ ./test/rand_test
 [DEBUG] Compiled with debugging symbols.
 74, 14, 47, 92, 88
 [pram at no build]$ ./test/rand_test
 [DEBUG] Compiled with debugging symbols.
 74, 14, 47, 92, 88
 [pram at no build]$ ./test/rand_test
 [DEBUG] Compiled with debugging symbols.
 74, 14, 47, 92, 88

 }}}

-- 
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/193>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed by the FASTLAB at Georgia Tech under Dr. Alex Gray.


More information about the mlpack-svn mailing list