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>
25 IMPKERNEL_BEGIN_NAMESPACE
42 template<
typename RealType>
45 RealType mean=0.0, RealType stddev=1.0)
50 #ifdef IMP_KERNEL_CUDA_LIB
52 IMPcuda::kernel::internal::get_random_numbers_normal_cuda
53 (&v[0], n, mean, stddev);
55 internal::get_random_numbers_normal_boost(&v[0], n, mean, stddev);
71 template<
typename RealType>
78 #ifdef IMP_KERNEL_CUDA_LIB
80 IMPcuda::kernel::internal::get_random_numbers_uniform_cuda (&v[0], n);
82 internal::get_random_numbers_uniform_boost(&v[0], n);
120 #ifdef IMP_KERNEL_CUDA_LIB
121 const static unsigned int cache_n=20000000;
123 static unsigned int i=0;
130 static boost::uniform_real<float> rand(0.0, 1.0);
139 #ifdef IMP_KERNEL_CUDA_LIB
142 ::boost::uniform_real<float> rand(min, max);
151 #ifdef IMP_KERNEL_CUDA_LIB
152 const static unsigned int cache_n=20000000;
154 static unsigned int i=0;
161 static boost::uniform_real<double> rand(0.0, 1.0);
169 #ifdef IMP_KERNEL_CUDA_LIB
172 ::boost::uniform_real<double> rand(min, max);
179 IMPKERNEL_END_NAMESPACE
void get_random_numbers_uniform(Vector< RealType > &v, unsigned int n)
Fill the float array with random uniformly distributed values.
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.