29 static bool cached =
false;
38 double r2 = u * u + v * v;
44 const double p =
sqrt(-2. * log(r2) / r2);
60 return mu + gamma * tan(Pi * (
RndmUniform() - 0.5));
67inline double RndmVoigt(
const double mu,
const double sigma,
71 const double a = gamma / (Sqrt2 * sigma);
73 return mu + x * Sqrt2 * sigma;
82 const double c = 3 * (theta + 1.) - 0.75;
83 double u1, u2, v1, v2, v3;
88 if (v1 == 0.)
continue;
89 v2 = (u1 - 0.5) *
sqrt(c / v1);
91 if (x <= 0.)
continue;
93 v3 = 64 * u2 * u2 *
pow(v1, 3);
94 if (v3 <= 1. - 2 * v2 * v2 / x ||
95 log(v3) <= 2 * (theta * log(x / theta) - v2)) {
96 return x / (theta + 1.);
DoubleAc pow(const DoubleAc &f, double p)
DoubleAc sqrt(const DoubleAc &f)
double RndmLorentzian(const double mu, const double gamma)
double RndmPolya(const double theta)
double RndmVoigt(const double mu, const double sigma, const double gamma)
RandomEngineRoot randomEngine