Logo ROOT   6.10/09
Reference Guide
FlatRandomGen.h
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 #ifndef MN_FlatRandomGen_H_
11 #define MN_FlatRandomGen_H_
12 
13 #include <cmath>
14 
15 namespace ROOT {
16 
17  namespace Minuit2 {
18 
19 
21 
22 public:
23 
24  FlatRandomGen() : fMean(0.5), fDelta(0.5) {}
25 
26  FlatRandomGen(double mean, double delta) : fMean(mean), fDelta(delta) {}
27 
29 
30  double Mean() const {return fMean;}
31 
32  double Delta() const {return fDelta;}
33 
34  double operator()() const {
35  return 2.*Delta()*(std::rand()/double(RAND_MAX) - 0.5) + Mean();
36  }
37 
38 private:
39 
40  double fMean;
41  double fDelta;
42 };
43 
44  } // namespace Minuit2
45 
46 } // namespace ROOT
47 
48 #endif //MN_FlatRandomGen_H_
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
Float_t delta
FlatRandomGen(double mean, double delta)
Definition: FlatRandomGen.h:26