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 Revision 1.2 2000/12/01 08:40:48 alibrary
19 Correction of a small bug - sRandom can be used now
21 Revision 1.1 2000/11/30 07:12:48 alibrary
22 Introducing new Rndm and QA classes
26 ///////////////////////////////////////////////////////////////////////////////
29 ///////////////////////////////////////////////////////////////////////////////
40 //_____________________________________________________________________________
41 void AliRndm::Rndm(Float_t* array, const Int_t size) const
44 // Return an array of n random numbers uniformly distributed
45 // between 0 and 1 not included
47 for(Int_t i=0; i<size; i++)
49 array[i]=fRandom->Rndm();
51 do array[i]=fRandom->Rndm(); while(0>=array[i] || array[i]>=1);
55 //_____________________________________________________________________________
56 void AliRndm::ReadRandom(const char *filename)
59 // Reads saved random generator status from filename
61 char *fntmp = gSystem->ExpandPathName(filename);
62 TFile *file = new TFile(fntmp,"r");
65 printf("AliRndm:: Could not open file %s\n",filename);
67 if(!fRandom) fRandom = new TRandom();
68 fRandom->Read("Random");
74 //_____________________________________________________________________________
75 void AliRndm::WriteRandom(const char *filename) const
78 // Writes random generator status to filename
80 char *fntmp = gSystem->ExpandPathName(filename);
81 TFile *file = new TFile(fntmp,"new");
84 printf("AliRndm:: Could not open file %s\n",filename);