Re: TRandom class with random initialization

Rene Brun (Rene.Brun@cern.ch)
Fri, 04 Dec 1998 12:21:20 +0100


Hi Alexander,
I have included your proposed changes to TRandom in the
development version. I had to make a few changes to have
a portable implementation.

Rene Brun

Alexander Zvyagin wrote:
>
> Date: Mon, 30 Nov 1998 15:42:59 +0000
> From: Alexander Zvyagin <ZVYAGIN_at_mx.ihep.su>
> X-Sender: ZVYAGIN@polar.ihep.su
> To: roottalk@hpsalo.cern.ch
> Subject: TRandom class with random initialization
> Message-ID: <Pine.VMS.3.91-b11-vms.981130153219.14529B-100000@polar.ihep.su>
> MIME-Version: 1.0
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
> Dear ROOTers,
>
> May be it will be good to add new constructor/function in TRandom class for
> 'random' initialization of seed number.
>
> The code is below. It assumed that sizeof(time_t)<=sizeof(fSeed).
>
> class TRandom : public TNamed
> {
> TRandom(UInt_t seed=65539);
> ....
> };
>
> #include <time.h>
>
> TRandom::TRandom(UInt_t seed): TNamed("Random","Default Random number
> generator") {
> //*-*-*-*-*-*-*-*-*-*-*default constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> //*-* ===================
> if( seed==0 ) // Set 'random' seed number if seed=0
> time(&fSeed); // Get current time in fSeed.
> else
> fSeed = seed;
> }
>
> With best wishes,
> Alexander