Page 1 of 1
Is one set_seed enough?
Posted: Sat Mar 28, 2009 5:11 pm
I have 5 neurons each with 3 different mechanisms (3 different mod files). Each mod file has a procedure to execute "set_seed(seed)" where argument seed is provided by the hoc file. So set_seed() is called with 5*3=15 different seed values.
The mod files use either normrand() or scop_random() to get random numbers. All I want to ensure is that the 15 instances generate different sequences of random numbers.
Setting 5*3=15 different seed values is appropriate if there are 15 seperate random number generators (one for each instance). But if there is only 1 random number generator for each simulation then I only need to call it once.
How many random number generators would there be in the setup described in the first paragraph?
Re: Is one set_seed enough?
Posted: Sun Mar 29, 2009 11:08 am
Should be straightforward to discover for yourself.
Revise the mechanisms so that the variable that is assigned a pseudorandom value is RANGE.
Make a toy model with just one cell.
Use Vector record() to capture the time course of those variables.
Call only one mechanism's set_seed to initialize the seed to some value A
Run a simulation just long enough to generate ~5 pseudorandom values in each recorded Vector.
Copy the recorded Vectors to a new set of vectors.
Compare the copies of the recorded vectors to each other. If the mechanisms are taking turns drawing values from a single pseudorandom sequence, the three vectors should have very different contents. If each mechanism has its own seed, the two mechanisms that you did not seed should produce vectors that contain identical values.
Call each mechanism's set_seed, but use different values B and C for mechanisms 2 and 3, and call mechanism 1's set_seed last, with the same seed as in the first run.
Compare the recorded vectors to each other. If the mechanisms are taking turns drawing values from a single pseudorandom sequence, the three vectors should have very different contents, and each vector should contain values that are identical to those values that it recorded in Test 1. If each mechanism has its own seed, mechanism 1's vector should be identical to what it was in Test 1. The vectors for mechanisms 2 and 3 should have different values from each other and from mechanism 1's vector.
What did you find out?
Re: Is one set_seed enough?
Posted: Thu Apr 02, 2009 6:21 pm
Just after pressing submit, I realised that I could have tested it myself. So I appreciate your response. The results of my tests are that there is only 1 random number generator so I only need to set_seed once. Hopefully, I did it right.
So this would be different from Random() since the manual states "Note that multiple instances of the Random class will produce different streams of random numbers only if their seeds are different."