#ifndef ROOT_Math_Random
#define ROOT_Math_Random
#include "Math/RandomFunctions.h"
namespace ROOT {
namespace Math {
template < class Engine>
class Random {
public:
typedef typename Engine::BaseType EngineBaseType;
typedef RandomFunctions<Engine, EngineBaseType> RndmFunctions;
Random() :
fEngine(),
fFunctions(fEngine)
{}
explicit Random(unsigned int seed) :
fEngine(),
fFunctions(fEngine)
{
fEngine.SetSeed(seed);
}
double Rndm() {
return fEngine();
}
void RndmArray(int n, double * array) {
fEngine.RandomArray(array, array+n);
}
std::string Type() const {
return fEngine.Name();
}
unsigned int EngineSize() const {
return fEngine.Size();
}
double operator() (){
return fEngine();
}
uint64_t Integer() {
return fEngine.IntRndm();
}
static uint64_t MaxInt() {
return Engine::Max();
}
Engine & Rng() {
return fEngine;
}
double Exp(double tau) {
return fFunctions.Exp(tau);
}
double Gaus(double mean = 0, double sigma = 1) {
return fFunctions.Gaus(mean,sigma);
}
double Gamma(double a, double b) {
return fFunctions.Gamma(a,b);
}
double Beta(double a, double b) {
return fFunctions.Beta(a,b);
}
double LogNormal(double zeta, double sigma) {
return fFunctions.LogNormal(zeta,sigma);
}
double ChiSquare(double nu) {
return fFunctions.ChiSquare(nu);
}
double Rayleigh(double sigma) {
return fFunctions.Rayleigh(sigma);
}
double Logistic(double a) {
return fFunctions.Logistic(a);
}
double Pareto(double a, double b) {
return fFunctions.Pareto(a, b);
}
double FDist(double nu1, double nu2) {
return fFunctions.FDist(nu1,nu2);
}
double tDist(double nu) {
return fFunctions.tDist(nu);
}
double Landau(double m = 0, double s = 1) {
return fFunctions.Landau(m,s);
}
double BreitWigner(double mean = 0., double gamma = 1) {
return fFunctions.BreitWigner(mean,gamma);
}
void Circle(double &x, double &y, double r = 1) {
fFunctions.Circle(x,y,r);
}
void Sphere(double &x, double &y, double &z,double r = 1) {
fFunctions.Sphere(x,y,z,r);
}
unsigned int Binomial(unsigned int ntot, double prob) {
return fFunctions.Binomial(prob,ntot);
}
unsigned int Poisson(double mu) {
return fFunctions.Poisson(mu);
}
unsigned int NegativeBinomial(double n, double prob) {
return fFunctions.NegativeBinomial(prob,n);
}
std::vector<unsigned int> Multinomial( unsigned int ntot, const std::vector<double> & p ) {
return fFunctions.Multinomial(ntot,p);
}
double Uniform(double a, double b) {
return fFunctions.Uniform(a,b);
}
double Uniform(double a = 1.0) {
return fFunctions.Uniform(a);
}
double Uniform2(double a, double b) {
return fFunctions.UniformBase(a,b);
}
RandomFunctions<Engine,EngineBaseType> & Functions() {
return fFunctions;
}
void SetSeed(int seed) { fEngine.SetSeed(seed);}
private:
Engine fEngine;
RndmFunctions fFunctions;
};
}
}
#include "Math/MixMaxEngine.h"
#include "Math/MersenneTwisterEngine.h"
#include "Math/StdEngine.h"
namespace ROOT {
namespace Math {
typedef Random<ROOT::Math::MixMaxEngine<240,0>> RandomMixMax;
typedef Random<ROOT::Math::MersenneTwisterEngine> RandomMT19937;
typedef Random<ROOT::Math::StdEngine<std::mt19937_64>> RandomMT64;
typedef Random<ROOT::Math::StdEngine<std::ranlux48>> RandomRanlux48;
}
}
#endif /* ROOT_Math_Random */