How should I use random.jumpahead in Python

Posted by Peter Smit on Stack Overflow See other posts from Stack Overflow or by Peter Smit
Published on 2010-03-30T14:35:54Z Indexed on 2010/03/30 15:33 UTC
Read the original article Hit count: 316

Filed under:
|

I have a application that does a certain experiment 1000 times (multi-threaded, so that multiple experiments are done at the same time). Every experiment needs appr. 50.000 random.random() calls.

What is the best approach to get this really random. I could copy a random object to every experiment and do than a jumpahead of 50.000 * expid. The documentation suggests that jumpahead(1) already scrambles the state, but is that really true?

Or is there another way to do this in 'the best way'?

(No, the random numbers are not used for security, but for a metropolis hasting algorithm. The only requirement is that the experiments are independent, not whether the random sequence is somehow predictable or so)

© Stack Overflow or respective owner

Related posts about python

Related posts about random