Question about gRandom and TUUID

Dear ROOT experts,

In the documentation of TRandom3’s default constructor I read:

[quote] If seed is 0, the seed is automatically computed via a TUUID object.
In this case the seed is guaranteed to be unique in space and time.
[/quote]

What does it actually mean ‘to be unique in space and time’ in this context, i.e. how unique it is?

Example: I am submitting on a local cluster simulation, but different processes still sometimes get the same seed for gRandom. For instance, is it garanteed that processes running on same machine but utilizing different CPU cores are considered to be ‘unique in space’?

Attached is the down-to-earth example: Please copy the attached files in the same directory and execute the script ‘source submit.sh’. You see that in both processes the generated seed for gRandom via TUUID was the same :’(

Is there a way to ensure for implementation of this type the unique seed for gRandom per process?

Thanks and cheers,
Ante

P.S. ROOT 5.28/00f (tags/v5-28-00f@40489, Aug 09 2011, 09:20:21 on linuxx8664gcc)
submit.sh.tar.gz (203 Bytes)
temp.C (111 Bytes)

TRandom3 uses an array of 624 integers as “seed”.
TRandom3::GetSeed returns only the first integer of this array, so you get only a partial answer.
In case you get the same value returned by GetRandom from your different process, please post this case ::slight_smile:

Rene

Dear Rene,

Most likely this answers my problem, but I will do some additional tests/checks (it is not easy to post my original code here because it is AliRoot dependent).

My idea was to use TRandom3::GetSeed to save the generated seed in particular process in its output log, and in the case the simulation with this seed crashes I could than pick up the used seed from the output log and via TRandom3::SetSeed have the crashed simulation exactly reproducible when I rerun for debugging.

Is there a simple way to achieve this in an alternative way?

Thanks,
Ante

Hi Ante,

You could store the TRandom3 object in the ROOT file …

Cheers,
Philippe.

Dear Rene and Philippe,

I did some additional checks: First confirmation that although TRandom3::GetSeed returned the same number in some processes, the simulation in each process produced different results, in accordance with what Rene explained.

I will than add few more lines in my code and utilize Phillippe’s suggestion.

Thanks for help,
Ante