On 9/11/2013 3:48 AM, Pascal Bit wrote:
from random import random
> [...]

Running on win7 python 2.7 32 bit it uses around 30 seconds avg.
Running on xubuntu, 32 bit, on vmware on windows 7: 20 seconds!
The code runs faster on vm, than the computer itself...
The python version in this case is 1.5 times faster...
I don't understand.

What causes this?

The random module uses os.urandom, which relies on OS implementations of randomness functionality:

"On a UNIX-like system this will query /dev/urandom, and on Windows it will use CryptGenRandom()."

http://docs.python.org/2/library/os.html#miscellaneous-functions

The linux implementation appears to be faster.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to