36 #ifndef RandExponential_h
37 #define RandExponential_h 1
61 static inline HepDouble shoot();
63 static inline HepDouble shoot( HepDouble mean );
65 static void shootArray (
const HepInt size, HepDouble* vect,
67 #ifndef ST_NO_TEMPLATE_DEF_ARGS
68 static void shootArray ( vector<HepDouble>&,
71 static void shootArray ( vector<HepDouble, allocator<HepDouble> >&,
79 static inline HepDouble shoot(
HepRandomEngine* anEngine, HepDouble mean );
82 HepDouble* vect, HepDouble mean=1.0 );
83 #ifndef ST_NO_TEMPLATE_DEF_ARGS
85 vector<HepDouble>&, HepDouble mean=1.0 );
88 vector<HepDouble,allocator<HepDouble> >&, HepDouble mean=1.0 );
93 inline HepDouble fire();
95 inline HepDouble fire( HepDouble mean );
97 void fireArray (
const HepInt size, HepDouble* vect, HepDouble mean=1.0 );
98 #ifndef ST_NO_TEMPLATE_DEF_ARGS
99 void fireArray ( vector<HepDouble>&, HepDouble mean=1.0 );
101 void fireArray ( vector<HepDouble, allocator<HepDouble> >&, HepDouble mean=1.0 );
103 HepDouble operator()();
108 HepBoolean deleteEngine;
117 : localEngine(&anEngine), deleteEngine(false) {}
120 : localEngine(anEngine), deleteEngine(true) {}
122 inline HepDouble RandExponential::shoot() {
123 return -::log(HepRandom::getTheGenerator()->flat());
126 inline HepDouble RandExponential::shoot(HepDouble mean) {
127 return -::log(HepRandom::getTheGenerator()->flat())*mean;
133 return -::log(anEngine->flat());
138 return -::log(anEngine->flat())*mean;
143 inline HepDouble RandExponential::fire() {
144 return -::log(localEngine->flat());
147 inline HepDouble RandExponential::fire(HepDouble mean) {
148 return -::log(localEngine->flat())*mean;