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 ///////////////////////////////////////////////////////////////////////////////
19 // Random number class for AliRoot
20 // This class allows to have different
21 // random number generator for different
22 // elements of AliRoot //
23 // It also allows saving and retrieving of the random number seeds
24 ///////////////////////////////////////////////////////////////////////////////
35 //_______________________________________________________________________
44 //_______________________________________________________________________
45 AliRndm::AliRndm(const AliRndm& rn):
54 //_______________________________________________________________________
55 void AliRndm::Copy(AliRndm&) const
57 ::Fatal("Copy","Not implemented\n");
61 //_____________________________________________________________________________
62 void AliRndm::Rndm(Float_t* array, Int_t size) const
65 // Return an array of n random numbers uniformly distributed
66 // between 0 and 1 not included
68 for(Int_t i=0; i<size; i++)
70 array[i]=fRandom->Rndm();
72 do array[i]=fRandom->Rndm(); while(0>=array[i] || array[i]>=1);
76 //_____________________________________________________________________________
77 void AliRndm::ReadRandom(const char *filename)
80 // Reads saved random generator status from filename
82 char *fntmp = gSystem->ExpandPathName(filename);
83 TFile *file = new TFile(fntmp,"r");
86 printf("AliRndm:: Could not open file %s\n",filename);
88 if(!fRandom) fRandom = new TRandom();
89 fRandom->Read("Random");
95 //_____________________________________________________________________________
96 void AliRndm::WriteRandom(const char *filename) const
99 // Writes random generator status to filename
101 char *fntmp = gSystem->ExpandPathName(filename);
102 TFile *file = new TFile(fntmp,"new");
105 printf("AliRndm:: Could not open file %s\n",filename);