Re: Random numbers

Rene Brun (Rene.Brun@cern.ch)
Tue, 23 Sep 1997 17:38:45 +0200


Nick van Eijndhoven wrote:
>
> Dear all,
> Is there a facility within ROOT to obtain random numbers via a user
> defined function ?
> A scenario of filling first a histo according to some function and then
> obtain random numbers according to that hist would do fine for the moment.
> However, some facility to provide a function pointer of a user defined function
> and then be able to retrieve random numbers from that would of course be
> nicer. Maybe something like the fitting of user functions to a histo could
> be provided for class TRandom ?
>

You can use TH1::FillRandom. (see the fillrandom tutorial).
Fill Random fills an histogram from a user definer function.
I intend to extend the TF1 and TF2 classes to return random numbers
from any type of functions. This is in the pipeline.

Rene Brun