Bill Jackson wrote: > Is there a preferred random library? > > scipy.random > random > > Besides scipy's library returning ndarrays, is there any other > advantage/disadvantage?
numpy.random (since that's where scipy.random comes from, I recommend always referring to it as numpy.random) can be a bit faster since it is implemented as entirely an extension module; parts of random are implemented in Python and incur Python function call overhead. It's certainly faster if you need a lot of numbers at once. numpy.random has several more non-uniform distributions implemented. numpy.random does not implement jumpahead(). random, naturally, does not require a third-party package. By and large, I'd say the distinguishing factor is whether or not you want to use numpy in your program. If so, then use numpy.random. If not, then use random. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list