Message: Re: Same outputs from same number of events Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Same outputs from same number of events 

Forum: Run Management
Re: Question Same outputs from same number of events (A. Hod)
Re: Feedback Re: Same outputs from same number of events (Michael H. Kelsey)
Re: Question Re: Same outputs from same number of events (A. Hod)
Date: 03 Aug, 2017
From: Michael H. Kelsey <Michael H. Kelsey>

A. Hod writes:
> Thanks. Is there an example in Genat4/examples/.. which can do this?

No, I don't see one.  Below, I've quoted the block of code from my own
simulation framework where we do this.  You will need to have libuuid_devel
installed on your Linux system in order to get the necessary .h files.  I
stripped out my diagnostic stuff, so you could see clearly the method.

> by the way I am using GPS..

The generator doesn't matter.  Random number management is handled in the G4
kernel.
    -- Mike Kelsey

#include <uuid/uuid.h>

// Generate unique random seeds from a UUID and write into engine
void CDMSRandomManager::generateSeeds() {
  // Create array of longs big enough to hold UUID plus zero terminator
  const size_t nlong = sizeof(uuid_t)/sizeof(long) + 1;
  long* seeds = new long[nlong];
  seeds[nlong-1] = 0;

  // Generate a globally-unique bit string for the random engine
  unsigned char* theUUID = (unsigned char*)&seeds[0];
  uuid_generate(theUUID);
  
  G4Random::setTheSeeds(seeds);
  delete[] seeds;               // Clean up memory before exit
}

 Add Message Add Message
to: "Re: Same outputs from same number of events"

 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 ]