8 #ifndef IMPKERNEL_RANDOM_H
9 #define IMPKERNEL_RANDOM_H
11 #include <IMP/kernel_config.h>
15 IMPKERNEL_BEGIN_NAMESPACE
17 #ifndef SWIG // the RNG is defined explicitly in pyext/IMP_kernel.random.i
19 class RandomNumberGenerator :
public std::mt19937 {
20 typedef std::mt19937 T;
21 T::result_type last_seed_;
22 unsigned seed_counter_;
25 RandomNumberGenerator()
26 : T(default_seed), last_seed_(default_seed), seed_counter_(1) {}
28 RandomNumberGenerator(T::result_type seed)
29 : T(seed), last_seed_(seed), seed_counter_(1) {}
31 void seed() { seed(default_seed); }
34 void seed(T::result_type seed) {
37 if (seed_counter_ == 0) {
45 T::result_type get_last_seed()
const {
return last_seed_; }
50 unsigned get_seed_counter()
const {
return seed_counter_; }
76 IMPKERNEL_END_NAMESPACE
boost::uint64_t get_random_seed()
Return the initial random seed.
A class for storing lists of IMP items.
RandomNumberGenerator random_number_generator
A shared non-GPU random number generator.