CLHEP 2.4.7.1
C++ Class Library for High Energy Physics
RandBit.icc
Go to the documentation of this file.
1// $Id: RandBit.icc,v 1.3 2010/06/16 17:24:53 garren Exp $
2// -*- C++ -*-
3//
4// -----------------------------------------------------------------------
5// HEP Random
6// --- RandBit ---
7// inlined functions implementation file
8// -----------------------------------------------------------------------
9
10// =======================================================================
11// M.Fischler - Created, along same lines as RandGaussQ.icc
12// =======================================================================
13
14namespace CLHEP {
15
17: RandFlat (anEngine)
18{}
19
20inline RandBit::RandBit(HepRandomEngine & anEngine, double width )
21: RandFlat (anEngine, width)
22{}
23
24inline RandBit::RandBit(HepRandomEngine & anEngine, double a,
25 double b )
26: RandFlat (anEngine, a, b)
27{}
28
30: RandFlat (anEngine)
31{}
32
33inline RandBit::RandBit(HepRandomEngine * anEngine, double width )
34: RandFlat (anEngine, width)
35{}
36
37inline RandBit::RandBit(HepRandomEngine * anEngine, double a,
38 double b )
39: RandFlat (anEngine, a, b)
40{}
41
42//---------------------
43
44inline int RandBit::shootBit() {
45 double x = shoot();
46 return (x > .5) ? 1 : 0;
47}
48
49//---------------------
50
51
53 double x = shoot(engine);
54 return (x > .5) ? 1 : 0;
55}
56
57//---------------------
58
59
60inline int RandBit::fireBit() {
61 double x = fire(0,1);
62 return (x > .5) ? 1 : 0;
63}
64
65} // namespace CLHEP
static int shootBit()
Definition RandBit.icc:44
RandBit(HepRandomEngine &anEngine)
Definition RandBit.icc:16
static double shoot()
HepRandomEngine & engine()