1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Wrapper for the root random number generator //
22 ///////////////////////////////////////////////////////////////////////////////
33 //_______________________________________________________________________
43 //_______________________________________________________________________
44 AliRndm::AliRndm(const AliRndm& rn):
53 //_______________________________________________________________________
54 void AliRndm::Copy(AliRndm&) const
56 ::Fatal("Copy","Not implemented\n");
60 //_____________________________________________________________________________
61 void AliRndm::Rndm(Float_t* array, const Int_t size) const
64 // Return an array of n random numbers uniformly distributed
65 // between 0 and 1 not included
67 for(Int_t i=0; i<size; i++)
69 array[i]=fRandom->Rndm();
71 do array[i]=fRandom->Rndm(); while(0>=array[i] || array[i]>=1);
75 //_____________________________________________________________________________
76 void AliRndm::ReadRandom(const char *filename)
79 // Reads saved random generator status from filename
81 char *fntmp = gSystem->ExpandPathName(filename);
82 TFile *file = new TFile(fntmp,"r");
85 printf("AliRndm:: Could not open file %s\n",filename);
87 if(!fRandom) fRandom = new TRandom();
88 fRandom->Read("Random");
94 //_____________________________________________________________________________
95 void AliRndm::WriteRandom(const char *filename) const
98 // Writes random generator status to filename
100 char *fntmp = gSystem->ExpandPathName(filename);
101 TFile *file = new TFile(fntmp,"new");
104 printf("AliRndm:: Could not open file %s\n",filename);