9 #ifndef IMPKERNEL_RANDOM_UTILS_H
10 #define IMPKERNEL_RANDOM_UTILS_H
12 #include <IMP/kernel_config.h>
15 #ifdef IMP_KERNEL_CUDA_LIB
17 #include "IMP/internal/random_number_generation_cuda.h"
20 #include "IMP/internal/random_number_generation_boost.h"
23 #include <boost/random/mersenne_twister.hpp>
24 #include <boost/random/uniform_real.hpp>
29 IMPKERNEL_BEGIN_NAMESPACE
46 template<
typename RealType>
49 RealType mean=0.0, RealType stddev=1.0)
57 #ifdef IMP_KERNEL_CUDA_LIB
59 IMPcuda::kernel::internal::get_random_numbers_normal_cuda
60 (&v[0], n, mean, stddev);
62 internal::get_random_numbers_normal_boost(&v[0], n, mean, stddev);
84 template<
typename RealType>
91 #ifdef IMP_KERNEL_CUDA_LIB
93 IMPcuda::kernel::internal::get_random_numbers_uniform_cuda (&v[0], n);
95 internal::get_random_numbers_uniform_boost(&v[0], n);
133 #ifdef IMP_KERNEL_CUDA_LIB
134 const static unsigned int cache_n=20000000;
136 static unsigned int i=0;
143 static boost::uniform_real<float> rand(0.0, 1.0);
152 #ifdef IMP_KERNEL_CUDA_LIB
155 ::boost::uniform_real<float> rand(min, max);
164 #ifdef IMP_KERNEL_CUDA_LIB
165 const static unsigned int cache_n=2000000;
167 static unsigned int i=0;
174 static boost::uniform_real<double> rand(0.0, 1.0);
182 #ifdef IMP_KERNEL_CUDA_LIB
185 ::boost::uniform_real<double> rand(min, max);
192 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.