Re: Code with random module faster on the vm than the vm host...

2013-11-10 Thread alex23
On 11/11/2013 11:19 AM, Robert Kern wrote: On 2013-11-11 00:49, alex23 wrote: The random module uses os.urandom, No, it doesn't. random.random() is an alias to the random() method on the random.Random class, which uses the Mersenne Twister to generate values. os.urandom() gets called in the in

Re: Code with random module faster on the vm than the vm host...

2013-11-10 Thread Mark Lawrence
On 11/11/2013 01:15, Ned Batchelder wrote: On Friday, November 8, 2013 12:48:04 PM UTC-5, Pascal Bit wrote: Here's the code: from random import random from time import clock s = clock() for i in (1, 2, 3, 6, 8): M = 0 N = 10**i for n in xrange(N): r = random()

Re: Code with random module faster on the vm than the vm host...

2013-11-10 Thread Ned Batchelder
On Friday, November 8, 2013 12:48:04 PM UTC-5, Pascal Bit wrote: > Here's the code: > > from random import random > from time import clock > > s = clock() > > for i in (1, 2, 3, 6, 8): > M = 0 > N = 10**i > > for n in xrange(N): > r = random() > if 0.5 < r < 0.6

Re: Code with random module faster on the vm than the vm host...

2013-11-10 Thread Robert Kern
On 2013-11-11 00:49, alex23 wrote: 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..

Re: Code with random module faster on the vm than the vm host...

2013-11-10 Thread alex23
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

Code with random module faster on the vm than the vm host...

2013-11-08 Thread Pascal Bit
Here's the code: from random import random from time import clock s = clock() for i in (1, 2, 3, 6, 8): M = 0 N = 10**i for n in xrange(N): r = random() if 0.5 < r < 0.6: M += 1 k = (N, float(M)/N) print (clock()-s) Running on win7 python 2.7 32 b