Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:37

0001 // $Id: RandBit.icc,v 1.3 2010/06/16 17:24:53 garren Exp $
0002 // -*- C++ -*-
0003 //
0004 // -----------------------------------------------------------------------
0005 //                            HEP Random
0006 //                         --- RandBit ---
0007 //                 inlined functions implementation file
0008 // -----------------------------------------------------------------------
0009 
0010 // =======================================================================
0011 // M.Fischler     - Created, along same lines as RandGaussQ.icc
0012 // =======================================================================
0013 
0014 namespace CLHEP {
0015 
0016 inline RandBit::RandBit(HepRandomEngine & anEngine)
0017 : RandFlat (anEngine)
0018 {}
0019 
0020 inline RandBit::RandBit(HepRandomEngine & anEngine, double width )
0021 : RandFlat (anEngine, width)
0022 {}
0023 
0024 inline RandBit::RandBit(HepRandomEngine & anEngine, double a,
0025                                                       double b )
0026 : RandFlat (anEngine, a, b)
0027 {}
0028 
0029 inline RandBit::RandBit(HepRandomEngine * anEngine)
0030 : RandFlat (anEngine)
0031 {}
0032 
0033 inline RandBit::RandBit(HepRandomEngine * anEngine, double width )
0034 : RandFlat (anEngine, width)
0035 {}
0036 
0037 inline RandBit::RandBit(HepRandomEngine * anEngine, double a,
0038                                                       double b )
0039 : RandFlat (anEngine, a, b)
0040 {}
0041 
0042 //---------------------
0043 
0044 inline int RandBit::shootBit() {
0045   double x = shoot();
0046   return (x > .5) ? 1 : 0;
0047 }
0048 
0049 //---------------------
0050 
0051 
0052 inline int RandBit::shootBit(HepRandomEngine* engine) {
0053   double x = shoot(engine);
0054   return (x > .5) ? 1 : 0;
0055 }
0056 
0057 //---------------------
0058 
0059 
0060 inline int RandBit::fireBit() {
0061   double x = fire(0,1);
0062   return (x > .5) ? 1 : 0;
0063 }
0064 
0065 }  // namespace CLHEP