Message: HepRandom How to use setTheSeed(s) and how to get RandomGenerator final state Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question HepRandom How to use setTheSeed(s) and how to get RandomGenerator final state 

Forum: Event and Track Management
Date: 05 Mar, 2012
From: Machiel Kolstein <Machiel Kolstein>

I have two questions.

1. I am not sure whether I should use "setTheSeed" or "setTheSeeds". I am running the same code lots of times and I would like to be sure it never starts with the same random seed. I thought the following would be the best way for that:

	time_t systime = time(NULL);
	long seed = (long) systime;
	CLHEP::HepRandom::setTheSeed(seed);
	double phi;
	for (int i = 0; i < 5; i++)
	{
		phi = CLHEP::RandFlat::shoot(2.0 * kPI);
		...
	}

2. At the end of my code, I want to print out the current state of the random generator, so that the next time I start the program, it will continue just where it stopped the previous time. I thought "getTheSeed" would give me that, but instead, it only gives me the initial seed.

Best regards,

Machiel

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: HepRandom How to use setTheSeed(s) and how to get RandomGenerator final state   (michel maire - 05 Mar, 2012)
2 Feedback: Re: HepRandom How to use setTheSeed(s) and how to get RandomGenerator final state   (Gumplinger Peter - 05 Mar, 2012)
 Add Message Add Message
to: "HepRandom How to use setTheSeed(s) and how to get RandomGenerator final state"

 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 ]