17 #ifndef ROOT_Math_Random
18 #define ROOT_Math_Random
38 template <
class Engine>
43 typedef typename Engine::BaseType EngineBaseType;
44 typedef RandomFunctions<Engine, EngineBaseType> RndmFunctions;
51 explicit Random(
unsigned int seed) :
55 fEngine.SetSeed(seed);
67 void RndmArray(
int n,
double * array) {
68 fEngine.RandomArray(array, array+n);
74 std::string Type()
const {
75 return fEngine.Name();
81 unsigned int EngineSize()
const {
82 return fEngine.Size();
91 return fEngine.IntRndm();
94 static uint64_t MaxInt() {
103 double Exp(
double tau) {
104 return fFunctions.Exp(tau);
107 double Gaus(
double mean = 0,
double sigma = 1) {
108 return fFunctions.Gaus(mean,sigma);
112 double Gamma(
double a,
double b) {
113 return fFunctions.Gamma(a,b);
117 double Beta(
double a,
double b) {
118 return fFunctions.Beta(a,b);
122 double LogNormal(
double zeta,
double sigma) {
123 return fFunctions.LogNormal(zeta,sigma);
127 double ChiSquare(
double nu) {
128 return fFunctions.ChiSquare(nu);
132 double Rayleigh(
double sigma) {
133 return fFunctions.Rayleigh(sigma);
137 double Logistic(
double a) {
138 return fFunctions.Logistic(a);
142 double Pareto(
double a,
double b) {
143 return fFunctions.Pareto(a, b);
147 double FDist(
double nu1,
double nu2) {
148 return fFunctions.FDist(nu1,nu2);
152 double tDist(
double nu) {
153 return fFunctions.tDist(nu);
157 double Landau(
double m = 0,
double s = 1) {
158 return fFunctions.Landau(m,s);
161 double BreitWigner(
double mean = 0.,
double gamma = 1) {
162 return fFunctions.BreitWigner(mean,gamma);
166 void Circle(
double &x,
double &y,
double r = 1) {
167 fFunctions.Circle(x,y,r);
171 void Sphere(
double &x,
double &y,
double &z,
double r = 1) {
172 fFunctions.Sphere(x,y,z,r);
179 unsigned int Binomial(
unsigned int ntot,
double prob) {
180 return fFunctions.Binomial(prob,ntot);
185 unsigned int Poisson(
double mu) {
186 return fFunctions.Poisson(mu);
192 unsigned int NegativeBinomial(
double n,
double prob) {
193 return fFunctions.NegativeBinomial(prob,n);
197 std::vector<unsigned int> Multinomial(
unsigned int ntot,
const std::vector<double> & p ) {
198 return fFunctions.Multinomial(ntot,p);
203 double Uniform(
double a,
double b) {
204 return fFunctions.Uniform(a,b);
206 double Uniform(
double a = 1.0) {
207 return fFunctions.Uniform(a);
209 double Uniform2(
double a,
double b) {
210 return fFunctions.UniformBase(a,b);
214 RandomFunctions<Engine,EngineBaseType> & Functions() {
218 void SetSeed(
int seed) { fEngine.SetSeed(seed);}
223 RndmFunctions fFunctions;
243 typedef Random<ROOT::Math::MixMaxEngine<240,0>> RandomMixMax;
244 typedef Random<ROOT::Math::MersenneTwisterEngine> RandomMT19937;
245 typedef Random<ROOT::Math::StdEngine<std::mt19937_64>> RandomMT64;
246 typedef Random<ROOT::Math::StdEngine<std::ranlux48>> RandomRanlux48;