I could copy a random object to each experiment and do than jump 50.000 * expid.
Approximately correct. Each thread gets its own instance of Random .
Put all of them in the same initial value. Use a constant for testing, use / dev / random when you "start recording".
Edit Outside of Python and in older implementations, use jumpahead( 50000 * expid ) to avoid the situation where two generators end up in parallel sequences of values. In any reasonably current (post 2.3) Python, jumpahead no longer linear, and using expid is sufficient to scramble the state.
You cannot just do jumpahead(1) in each thread, as this ensures that they are in sync. Use jumpahead( expid ) to ensure that each stream is distinctly scrambled.
The documentation suggests that jumpahead (1) already scrambles the state, but is that true?
Yes, jumpahead really "scrambles" the state. Recall that for a given seed you get one thing - a long but fixed sequence of pseudorandom numbers. You jump forward in this sequence. To pass random tests, you must get all of your values ββfrom this sequence.
Edit Once upon a time, jumpahead (1) was limited. Now jumpahead (1) really does more scrambling. However, scrambling is deterministic. You cannot just do jumpahead(1) in each thread.
If you have several generators with different seeds, you break the assumption "one sequence from one seed", and your numbers will not be as random as if you got them from one sequence.
If you only jump 1, you can get parallel sequences that may be similar. [This similarity cannot be detected; theoretically, there are similarities.]
When you jump 50,000, you are assuring that you are following the 1st sequence of 1-seed. You will also be convinced that in two experiments there will be no adjacent sequences of numbers.
Finally, you also have repeatability. For a given seed, you get consistent results.
The same jump: not good.
>>> y=random.Random( 1 ) >>> z=random.Random( 1 ) >>> y.jumpahead(1) >>> z.jumpahead(1) >>> [ y.random() for i in range(5) ] [0.99510321786951772, 0.92436920169905545, 0.21932404923057958, 0.20867489035315723, 0.91525579001682567] >>> [ z.random() for i in range(5) ] [0.99510321786951772, 0.92436920169905545, 0.21932404923057958, 0.20867489035315723, 0.91525579001682567]