Skip to content
Snippets Groups Projects
Commit 364834bd authored by Rene Brun's avatar Rene Brun
Browse files

On non-Windows systems use random/srandom instead of rand/srand.

git-svn-id: http://root.cern.ch/svn/root/trunk@17854 27541ba8-7e3a-0410-8455-c3a389f83636
parent e9003b7f
No related merge requests found
// @(#)root/base:$Name: $:$Id: TUUID.cxx,v 1.20 2005/12/04 01:29:43 rdm Exp $
// @(#)root/base:$Name: $:$Id: TUUID.cxx,v 1.21 2007/02/10 12:21:05 brun Exp $
// Author: Fons Rademakers 30/9/2001
/*************************************************************************
......@@ -138,10 +138,18 @@ TUUID::TUUID()
if (gSystem) {
// try to get a unique seed per process
UInt_t seed = (UInt_t) (long(gSystem->Now()) + gSystem->GetPid());
srand(seed);;
#ifdef R__WIN32
srand(seed);
#else
srandom(seed);
#endif
}
GetCurrentTime(&time_last);
#ifdef R__WIN32
clockseq = 1+(UShort_t)(65536*rand()/(RAND_MAX+1.0));
#else
clockseq = 1+(UShort_t)(65536*random()/(RAND_MAX+1.0));
#endif
firstTime = kFALSE;
}
......
// @(#)root/cont:$Name: $:$Id: TObjArray.cxx,v 1.31 2007/02/06 11:48:48 rdm Exp $
// @(#)root/cont:$Name: $:$Id: TObjArray.cxx,v 1.32 2007/02/10 13:32:37 brun Exp $
// Author: Fons Rademakers 11/09/95
/*************************************************************************
......@@ -614,7 +614,11 @@ void TObjArray::Randomize(Int_t ntimes)
for (Int_t i=0;i<ntimes;i++) {
for (Int_t j=0;j<fLast;j++) {
#ifdef R__WIN32
Int_t k = (Int_t)(fLast*rand()/(RAND_MAX+1.0));
#else
Int_t k = (Int_t)(fLast*rand()/(RAND_MAX+1.0));
#endif
if (k == j) continue;
TObject *obj = fCont[j];
fCont[j] = fCont[k];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment