Changeset 2804 for trunk/yat/random/random.cc
- Timestamp:
- Jul 31, 2012, 12:06:52 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/random/random.cc
r2802 r2804 127 127 if (rng_.get()==NULL) 128 128 rng_alloc(); 129 return gsl_rng_memcpy(rng_.get(), state.rng()); 129 if (gsl_rng_memcpy(rng_.get(), state.rng())) 130 throw utility::GSL_error("yat::random::RNG::set_state failed"); 131 return 0; 130 132 } 131 133 … … 160 162 assert(rng_!=&rng); 161 163 if (!(rng_ = gsl_rng_clone(&rng))) 162 throw utility::GSL_error("RNG_state:: RNG_state failed to allocate memory");164 throw utility::GSL_error("RNG_state::clone failed to allocate memory"); 163 165 } 164 166 … … 179 181 } 180 182 181 183 182 184 Discrete::~Discrete(void) 183 185 { … … 191 193 192 194 193 unsigned long Discrete::seed_from_devurandom(void) 194 { 195 return rng_->seed_from_devurandom(); 195 unsigned long Discrete::seed_from_devurandom(void) 196 { 197 return rng_->seed_from_devurandom(); 196 198 } 197 199 … … 201 203 { 202 204 p_.reserve(hist.nof_bins()); 203 for (size_t i=0; i<hist.nof_bins(); i++) 205 for (size_t i=0; i<hist.nof_bins(); i++) 204 206 p_.push_back(hist[i]); 205 207 preproc(); … … 267 269 { 268 270 return (range_ ? 269 gsl_rng_uniform_int(rng_->rng(), 271 gsl_rng_uniform_int(rng_->rng(),range_) : gsl_rng_get(rng_->rng())); 270 272 } 271 273
Note: See TracChangeset
for help on using the changeset viewer.