8 #ifndef IMPKERNEL_RANDOM_UTILS_H
9 #define IMPKERNEL_RANDOM_UTILS_H
11 #include <IMP/kernel_config.h>
14 #ifdef IMP_KERNEL_CUDA_LIB
16 #include "IMP/internal/random_number_generation_cuda.h"
19 #include "IMP/internal/random_number_generation_boost.h"
22 #include <boost/random/mersenne_twister.hpp>
23 #include <boost/random/uniform_real.hpp>
28 IMPKERNEL_BEGIN_NAMESPACE
45 template<
typename RealType>
48 RealType mean=0.0, RealType stddev=1.0)
56 #ifdef IMP_KERNEL_CUDA_LIB
58 IMPcuda::kernel::internal::get_random_numbers_normal_cuda
59 (&v[0], n, mean, stddev);
61 internal::get_random_numbers_normal_boost(&v[0], n, mean, stddev);
83 template<
typename RealType>
90 #ifdef IMP_KERNEL_CUDA_LIB
92 IMPcuda::kernel::internal::get_random_numbers_uniform_cuda (&v[0], n);
94 internal::get_random_numbers_uniform_boost(&v[0], n);
132 #ifdef IMP_KERNEL_CUDA_LIB
133 const static unsigned int cache_n=20000000;
135 static unsigned int i=0;
142 static boost::uniform_real<float> rand(0.0, 1.0);
151 #ifdef IMP_KERNEL_CUDA_LIB
154 ::boost::uniform_real<float> rand(min, max);
163 #ifdef IMP_KERNEL_CUDA_LIB
164 const static unsigned int cache_n=2000000;
166 static unsigned int i=0;
173 static boost::uniform_real<double> rand(0.0, 1.0);
181 #ifdef IMP_KERNEL_CUDA_LIB
184 ::boost::uniform_real<double> rand(min, max);
191 IMPKERNEL_END_NAMESPACE
void get_random_numbers_uniform(Vector< RealType > &v, unsigned int n)
Fill the float array with random uniformly distributed values.
A more IMP-like version of the std::vector.
boost::uint64_t get_random_seed()
Return the initial random seed.
double get_random_double_uniform(double min, double max)
Return a uniformly distributed double number in range [min..max)
float get_random_float_uniform(float min, float max)
Return a uniformly distributed float number in range [min..max)
A class for storing lists of IMP items.
void get_random_numbers_normal(Vector< RealType > &v, unsigned int n, RealType mean=0.0, RealType stddev=1.0)
Fill the double array with random normally distributed values.
Random number generators used by IMP.
RandomNumberGenerator random_number_generator
A shared non-GPU random number generator.