Random Number Generating


I am trying to get hold of the list of seeds used by the program to generate my values. But it only works for the first seed, and the rest aren’t. Here’s a snippet of the code:

TRandom3 random(12345);

seed1 = random.GetSeed(); //the cout here gives 12345
val1 = random.Uniform(1,10);
seed2 = random.GetSeed(); //the cout here gives 1421064939
val2 = random.Uniform(1,10);
seed3 = random.GetSeed(); //the cout here gives 1421064939 again …
val3 = random.Uniform(1,10);
seed4 = random.GetSeed(); // the cout here gives 1421064939 again…

but the values for val2 and val3 aren’t the same, but the seeds are the same as in 1421064939?

I’ll really like to know what are the seed used at each step. Thanks.

For the TRandom3 class, the seed is an array of 624 integers and the TRandom3::GetSeed() method returns only the first element of the seed array.