dear rooters,

i use TRandom->Gaus() to get random number from gausian distribution, now i want to generate random number from a distribution which is gaussian+uniform, is there easy way to do this? I mean, like TRandom->Myfunction(Gaus()+uniform()).

my procedure now is

(0)normalize the area of the joint distribution to 1.

(1)using uniform generator to generate a random number (0,1) r

(2)if r<0.4, using uniform generator to generate a random number

else, using gaussian generator to generate a random number

thanks in advance.

With ROOT you can get random numbers out of any 1-D, 2-D or 3-D distributions by creating TF1, TF2, TF3 objects respectively and use the TF1::GetRandom function.See many examples in the ROOT tutorials,

eg tutorials/spectrum/peaks.C

Rene

thanks