diff --git a/core/base/src/TUUID.cxx b/core/base/src/TUUID.cxx
index cf440305bb6746da045b6c8926a548b553779ccb..a0908cc5bc8f31761053ce7b6dea2201bd37b30e 100644
--- a/core/base/src/TUUID.cxx
+++ b/core/base/src/TUUID.cxx
@@ -138,6 +138,8 @@ TUUID::TUUID()
    static TTHREAD_TLS(UShort_t) clockseq;
    static TTHREAD_TLS(Bool_t) firstTime = kTRUE;
    if (firstTime) {
+      R__LOCKGUARD2(gROOTMutex); // rand and random are not thread safe.
+
       if (gSystem) {
          // try to get a unique seed per process
          UInt_t seed = (UInt_t) (Long64_t(gSystem->Now()) + gSystem->GetPid());