Changeset 2838 for trunk/yat/random/random.cc
- Timestamp:
- Sep 17, 2012, 1:12:53 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/0.9-stable (added) merged: 2822,2826,2829-2835
- Property svn:mergeinfo changed
-
trunk/yat/random/random.cc
r2804 r2838 24 24 #include "yat/statistics/Histogram.h" 25 25 #include "yat/utility/Exception.h" 26 27 #include <boost/thread/locks.hpp> 26 28 27 29 #include <cassert> … … 93 95 if (!rng) 94 96 throw utility::GSL_error("RNG failed to allocate memory"); 97 boost::unique_lock<boost::mutex> lock(mutex_); 95 98 gsl_rng_set(rng, seed_); 96 99 // bump seed to avoid subsequent gsl_rng to be identical … … 98 101 // rng_ owns rng and takes care of deallocation 99 102 rng_.reset(rng); 100 } 103 } // lock is released here 101 104 102 105 103 106 void RNG::seed(unsigned long s) const 104 107 { 108 boost::unique_lock<boost::mutex> lock(mutex_); 105 109 gsl_rng_set(rng(),s); 106 110 seed_ = s+1; 107 } 111 } // lock is released here 108 112 109 113
Note: See TracChangeset
for help on using the changeset viewer.