On Thursday 23 April 2015 11:53, Cem Karan wrote: > Precisely. In order to make my simulations more realistic, I use a lot of > random numbers. I can fake things by keeping the seed to the generator, > but if I want to do any sort of hardware in the loop simulations, then > that approach won't work.
That's exactly why we have *pseudo* random number generators. They are statistically indistinguishable from "real" randomness, but repeatable when needed. Obviously you need a high-quality PRNG like the Mersenne Twister, as used by Python. and you need to ensure that the distribution of values matches that of the real-life events. If you are truly paranoid, you might even run the simulation twice, using independent PRNGs (e.g. Mersenne Twister for one run, Marsaglia xorshift generator for another), and compare the results. But given that you are using a high-quality generator in the first place, that is unlikely to gain you anything. (MT is uniformly distributed with no correlations in up to 623 dimensions. I suppose it is possible if your simulation involves a phase space with more than 623 dimensions, it may inadvertently find correlations in the random numbers.) There's no benefit (except maybe speed, and probably not that) for using unrepeatable "real" random numbers. Using real randomness for simulations is a bad idea because it means you can never run the same simulation twice and you are forced to store large amounts of data instead of just storing the seed then running the simulation again. -- Steve -- https://mail.python.org/mailman/listinfo/python-list