Revision: 7377
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 20, 2008 07:17 by tkf
Initial Code
class ContinuousRand {
public:
double alpha, x;
boost::mt19937 gen;
boost::uniform_smallint<> dst;
boost::variate_generator<
boost::mt19937,boost::uniform_smallint<> > rand;
ContinuousRand(double _alpha): alpha(_alpha), x(0),
gen( static_cast<unsigned long>(std::time(0)) ), dst(0,1),
rand( gen, dst )
{}
double operator()(){
x += (static_cast<double>(rand())-0.5)*2.0;
x *= 1.0 - 1.0/alpha;
return x/sqrt(alpha);
}
};
Initial URL
Initial Description
Initial Title
Use random walk to get continuous random value
Initial Tags
Initial Language
C++