4 // -----------------------------------------------------------------------
6 // --- RandExponential ---
7 // inlined functions implementation file
8 // -----------------------------------------------------------------------
9 // This file is part of Geant4 (simulation toolkit for HEP).
11 // =======================================================================
12 // Gabriele Cosmo - Created: 19th August 1998
13 // =======================================================================
15 #include <cmath> // for log()
19 inline RandExponential::RandExponential(HepRandomEngine & anEngine,
21 : HepRandom(), localEngine(&anEngine, do_nothing_deleter()), defaultMean(mean) {}
23 inline RandExponential::RandExponential(HepRandomEngine * anEngine,
25 : HepRandom(), localEngine(anEngine), defaultMean(mean) {}
29 inline double RandExponential::shoot(HepRandomEngine* anEngine) {
30 return -std::log(anEngine->flat());
33 inline double RandExponential::shoot(HepRandomEngine* anEngine,
35 return -std::log(anEngine->flat())*mean;
40 inline double RandExponential::fire() {
41 return -std::log(localEngine->flat())*defaultMean;
44 inline double RandExponential::fire(double mean) {
45 return -std::log(localEngine->flat())*mean;