Randomness in Jython
Question: When using (pseudo) random numbers in Jython, would it be more efficient to
use the Python random module or Java's random class?


Answer: Python's version is much faster in a simple test on my Mac:

    
    
    jython -m timeit -s "import random" "random.random()"
    

1000000 loops, best of 3: 0.266 usec per loop

vs

    
    
     jython -m timeit -s "import java.util.Random; random=java.util.Random()" "random.nextDouble()"
    

1000000 loops, best of 3: 1.65 usec per loop

Jython version 2.5b3 and Java version 1.5.0_19.

