Re: TRandom class with random initialization

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Dec 04 1998 - 12:21:20 MET


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@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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:40 MET