Message: Possible bug in /random/setSeeds Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Warning Possible bug in /random/setSeeds 

Forum: Run Management
Date: 13 Feb, 2015
From: Andrew Green <Andrew Green>


I have encountered what I think is a bug in the implementation of the /random/setSeeds UI command. If I give the command really big seeds (i.e. 64-bit unsigned ints - equivalent to unsigned long long) then the seeds get truncated to LONG_MAX, and all runs are identical.

I was able to invoke this behaviour with a line like this:

/random/setSeeds 13276097254191301585 12293527212019250050

In this case the first two lines of G4Master_currentRun.rndm generated by setting /random/setSavingFlag 1 were:

Uvec 2226355706

If I then use a different pair of seeds:

/random/setSeeds 13042601405858215769 11535660870399727092

I get the exact same starting condition:

Uvec 2226355706

After a little bit of digging, I found that in the method StoI of G4UIMessenger, the conversion to long int behaves strangely and returns LONG_MAX for values larger than LONG_MAX. This means it is very easy to accidentally seed simulations with identical seeds.

The solution is obviously to use seeds smaller than LONG_MAX (2147483647 or larger, depending on the system), but maybe a warning for seeds larger than this should be incorporated?


 Add Message Add Message
to: "Possible bug in /random/setSeeds"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]