CLHEP 2.4.7.1
C++ Class Library for High Energy Physics
RandExponential.icc
Go to the documentation of this file.
1// $Id: RandExponential.icc,v 1.3 2010/06/16 17:24:53 garren Exp $
2// -*- C++ -*-
3//
4// -----------------------------------------------------------------------
5// HEP Random
6// --- RandExponential ---
7// inlined functions implementation file
8// -----------------------------------------------------------------------
9// This file is part of Geant4 (simulation toolkit for HEP).
10
11// =======================================================================
12// Gabriele Cosmo - Created: 19th August 1998
13// =======================================================================
14
15#include <cmath> // for log()
16
17namespace CLHEP {
18
20 double mean )
21: HepRandom(), localEngine(&anEngine, do_nothing_deleter()), defaultMean(mean) {}
22
24 double mean )
25: HepRandom(), localEngine(anEngine), defaultMean(mean) {}
26
27//-------------
28
29inline double RandExponential::shoot(HepRandomEngine* anEngine) {
30 return -std::log(anEngine->flat());
31}
32
34 double mean) {
35 return -std::log(anEngine->flat())*mean;
36}
37
38//-------------
39
40inline double RandExponential::fire() {
41 return -std::log(localEngine->flat())*defaultMean;
42}
43
44inline double RandExponential::fire(double mean) {
45 return -std::log(localEngine->flat())*mean;
46}
47
48} // namespace CLHEP
virtual double flat()=0
RandExponential(HepRandomEngine &anEngine, double mean=1.0)
static double shoot()