]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliRndm.h
README updated (R.Barbera)
[u/mrichter/AliRoot.git] / STEER / AliRndm.h
CommitLineData
65fb704d 1#ifndef ALIRNDM_H
2#define ALIRNDM_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8///////////////////////////////////////////////////////////////////////////////
9// //
10// Random Number Interface //
11// //
12///////////////////////////////////////////////////////////////////////////////
13
14#include <TRandom.h>
15
16static TRandom *sRandom;
17
18class AliRndm
19{
20public:
21 AliRndm() {SetRandom();}
22 virtual ~AliRndm() {fRandom=sRandom=0;}
23
24 // Random number generator bit
3e54283a 25 virtual void SetRandom(TRandom *ran=0)
ea5c7dc0 26 {if(ran) fRandom=sRandom=ran;
3e54283a 27 else fRandom=sRandom=gRandom;}
28
65fb704d 29 virtual TRandom* GetRandom() const {return fRandom;}
30 virtual void Rndm(Float_t* array, const Int_t size) const;
31#ifdef CKNONE
32 virtual Float_t Rndm() const {return fRandom->Rndm();}
33#else
34 virtual Float_t Rndm() const {
35 Float_t r;
36 do r=fRandom->Rndm(); while(0>=r || r>=1); return r;}
37#endif
38 virtual void WriteRandom(const char *filename) const;
39 virtual void ReadRandom(const char *filename);
40
41 protected:
42 TRandom *fRandom; // Pointer to the random number generator
43
44 private:
45 AliRndm(const AliRndm &) {}
46 AliRndm & operator=(const AliRndm &) {return (*this);}
47
48 ClassDef(AliRndm,1) //Random Number generator wrapper
49};
50
51#endif
52