If I don’t care about the accuracy, which random number engine is the fastest in G4,
using G4Random::setTheEngine?
Or should I write my own random engine?
r than the ROOT default TRandom3. in uniform [0,1) generator.
[2023-07-30 21:27:33.585] [debug] cyc , TIME Real:0.00 CPU:0.00
[2023-07-30 21:27:35.134] [debug] Geant4 Default, TIME Real:1.55 CPU:1.55
[2023-07-30 21:27:35.969] [debug] Geant4 Default ->flat, TIME Real:0.84 CPU:0.84
[2023-07-30 21:27:37.051] [debug] ROOT TRandom3, TIME Real:1.08 CPU:1.07
[2023-07-30 21:27:38.893] [debug] DualRand , TIME Real:1.84 CPU:1.84
[2023-07-30 21:27:40.679] [debug] James , TIME Real:1.79 CPU:1.79
[2023-07-30 21:27:43.265] [debug] Ranecu , TIME Real:2.59 CPU:2.59
[2023-07-30 21:27:44.813] [debug] MixMax , TIME Real:1.55 CPU:1.54
[2023-07-30 21:27:46.536] [debug] MTwistEngine, TIME Real:1.72 CPU:1.72
[2023-07-30 21:28:07.330] [debug] RanluxEngine, TIME Real:20.79 CPU:20.78
[2023-07-30 21:28:10.965] [debug] RanluxppEngine, TIME Real:3.63 CPU:3.63
[2023-07-30 21:28:12.623] [debug] RanshiEngine, TIME Real:1.66 CPU:1.66
I’ve try some random engine, it seems that G4 default random is fastest in G4 engine, but still slower than root TRandom,
It seems the step of G4Random → Get Engine cause almost 1/3 times for G4UniformRand(),
I thought it should be faster using static pointer method than.
#define G4UniformRand() CLHEP::HepRandom::getTheEngine()->flat();
is there any way like below?
extern HepEngine * gEngine
#define G4UniformRand() gEngine->flat();