27 #ifndef IMG_VALUE_UTIL_H
28 #define IMG_VALUE_UTIL_H
31 #include <boost/random.hpp>
36 namespace ost {
namespace img {
44 boost::mt19937 RandomGenerator(time(NULL));
45 boost::uniform_01<boost::mt19937> UniformRandom(RandomGenerator);
52 Real r=UniformRandom();
53 Real p=UniformRandom()*2.0*M_PI;
54 return Complex(r*cos(p),r*sin(p));
61 Real r=UniformRandom();
62 return static_cast<Word>(r*65536.0);
69 return UniformRandom();
77 boost::uniform_int<> dist(min,max);
85 template <
typename V,
typename R>
98 template <
typename V,
typename R>
100 R
Val2Val(
const V& v) {
return static_cast<R
>(v);}
103 template <
typename T>
119 template <
typename T>