[insert mandatory xkcd here]

On Wednesday, 19 March 2014 10:36:32 UTC-3, Patrick O'Leary wrote:
>
> On Tuesday, March 18, 2014 11:59:49 PM UTC-5, Ethan Anderes wrote:
>>
>> My main goal is to test  MCMC code on independently generated data. I 
>> guess I'm worried that if I start one run with srand(1) and the next with 
>> stand(2) there will be an overlap on the random number sequence that could 
>> cause problems. This is essentially due to my ignorance on how these 
>> work....
>>
>
> The good news is that this fear is unfounded. I think there's a tendency 
> to choose "psychologically random" numbers as PRNG seeds--I do it too--but 
> there's no real reason for it.
>
> I'd say that if you're serious about doing simulation, you'll find a basic 
> understanding of the mechanism behind pseudorandom number generation to be 
> extremely helpful. It will help not only in this situation--understanding 
> how a seed is stretched into a state vector (in Mersenne Twister, this is 
> typically done with a different PRNG)--but also in knowing the tradeoffs in 
> the algorithms.
>
> Story time: I was experiencing random errors on an 8-bit microcontroller 
> using C code generated from a Stateflow/Simulink diagram. Turns out that I 
> was using up the majority of the system's memory for the state vector of 
> the PRNG (which by default, is Mersenne Twister), and was experiencing 
> memory corruption from other parts of the program. I replaced the PRNG, 
> which has a period of 19937, with a fixed vector of numbers generated 
> offline with a period of about 10. For the application, that was acceptable!
>

Reply via email to