File indexing completed on 2025-01-18 09:54:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <cmath> // for log()
0016
0017 namespace CLHEP {
0018
0019 inline RandExponential::RandExponential(HepRandomEngine & anEngine,
0020 double mean )
0021 : HepRandom(), localEngine(&anEngine, do_nothing_deleter()), defaultMean(mean) {}
0022
0023 inline RandExponential::RandExponential(HepRandomEngine * anEngine,
0024 double mean )
0025 : HepRandom(), localEngine(anEngine), defaultMean(mean) {}
0026
0027
0028
0029 inline double RandExponential::shoot(HepRandomEngine* anEngine) {
0030 return -std::log(anEngine->flat());
0031 }
0032
0033 inline double RandExponential::shoot(HepRandomEngine* anEngine,
0034 double mean) {
0035 return -std::log(anEngine->flat())*mean;
0036 }
0037
0038
0039
0040 inline double RandExponential::fire() {
0041 return -std::log(localEngine->flat())*defaultMean;
0042 }
0043
0044 inline double RandExponential::fire(double mean) {
0045 return -std::log(localEngine->flat())*mean;
0046 }
0047
0048 }