Hi all,
I am trying to restart the random number generator from a previously stored seed, but I cannot get it to work using GetSeed and SetSeed. This code does not work:
void RestartRandom()
{
unsigned int StartSeed = 123456;
int Loops = 5;
gRandom->SetSeed(StartSeed);
cout<<"First batch with original seed: "<<endl;
for (unsigned int i = 0; i < Loops; ++i) {
cout<<gRandom->GetSeed()<<": "<<gRandom->Rndm()<<endl;
}
unsigned int Seed = gRandom->GetSeed();
cout<<"Second batch, a few more: "<<endl;
for (unsigned int i = 0; i < Loops; ++i) {
cout<<gRandom->GetSeed()<<": "<<gRandom->Rndm()<<endl;
}
cout<<"Third batch - set the seed to the one before the second batch in order to reproduce the second batch: "<<endl;
gRandom->SetSeed(Seed);
for (unsigned int i = 0; i < Loops; ++i) {
cout<<gRandom->GetSeed()<<": "<<gRandom->Rndm()<<endl;
}
}
Are there any other possibilities to restart the random number generator? I do not see anything in the source code…
Thanks,
Andreas