* Daniel De Marco <ddm@ge.infn.it> [15/01/2003 19:26]: > // return random number > Double_t dx = (fXmax-fXmin)/fNpx; > Int_t nbinmin=(min-fXmin)/dx; > Int_t nbinmax=(max-fXmin)/dx+1; > > Double_t pmin=fIntegral[nbinmin]; > Double_t pmax=fIntegral[nbinmax]; I found a wrong behaviour in the code I sent yesterday when max is equal to the upper limit of the function range. The above code should be replaced with the code below. // return random number Double_t dx = (fXmax-fXmin)/fNpx; Int_t nbinmin=(Int_t)((xmin-fXmin)/dx); Int_t nbinmax=(Int_t)((xmax-fXmin)/dx)+2; if(nbinmax>fNpx) nbinmax=fNpx; Double_t pmin=fIntegral[nbinmin]; Double_t pmax=fIntegral[nbinmax]; Thanks. Ciao, Daniel. --ddm
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET