Ignore:
Timestamp:
01/17/09 14:52:43 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r9219 r9226  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.43 2009-01-14 12:31:36 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.44 2009-01-17 14:52:37 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    2020!   Author(s): Thomas Bretz  3/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
    2121!
    22 !   Copyright: MAGIC Software Development, 2000-2005
     22!   Copyright: MAGIC Software Development, 2000-2009
    2323!
    2424!
     
    5050#ifndef ROOT_TComplex
    5151#include <TComplex.h>
     52#endif
     53
     54#ifndef ROOT_TRandom
     55#include <TRandom.h>  // gRandom in RndmExp
    5256#endif
    5357
     
    875879    e = error.Atof();
    876880}
     881
     882Double_t MMath::RndmExp(Double_t tau)
     883{
     884    // returns an exponential deviate.
     885    //
     886    //          exp( -t/tau )
     887
     888    const Double_t x = gRandom->Rndm(); // uniform on ] 0, 1 ]
     889
     890    return -tau * TMath::Log(x);       // convert to exponential distribution
     891}
Note: See TracChangeset for help on using the changeset viewer.