TRandom3::SetSeed() user case

hi,
here is a practical case for which we would need to be able to set a seed at each event. and i welcome some inputs here.
say we have, say, 3 ROOT files with a set of events, analysed by two people. the files are read as {f1, f2,f3} by the first team, and {f2,f3,f1} by the second. And some rejection has to be applied in the analysis, and the two teams need to cross-check the analysis. They have basically to use the same random number sequence, and this independently on which file is read first.
To do that, we were thinking of using the event number as seed (not the entry of the TChain, but the event number which is unique).
is there some limitation with using TRandom3 and set its seed like the case described above? don’t we introduce some bias. Or can we claim it’s safe?
root.cern.ch/root/html530/src/TR … x.html#185
Is there some other more clever approach here.
thanks.

1 Like

Hi,

It should be safe to use a seed for each event number. TRandom3 contains a state with 624 numbers which are initialized using a psudo-random number generator from the given seed. This gives quite different state for each different seed that is given. And is the procedure recommended by the author which fixes an old problem found with the seeding (math.sci.hiroshima-u.ac.jp/~ … 937ar.html ).
There is no theoretical proof for this, but I think you can use safely. If you observe a problem with the sequences, please let us know

Lorenzo

1 Like

For MC simulations and perfect reproducibility, the 32bit of TRandom::SetSeed are very small, considering that the cleanest solution is to seed each event separately, based on say, simulation identifier and event number.

On the page you link to, the procedure is actually described as state space initialization from a seed array of integers (NB this is also what a modern Fortran compiler provides). This seems more appropriate to the use case described above.

I would love to see this feature in ROOT’s TRandom3. I know that RNGs should be done right, so I would rather see an expert do it than myself. Any hope? Is anybody working on ROOT RNGs? Or did I simply not read the documentation closely enough to find an equivalent existing feature?