Points on and in spheres

Coz i din’t know the .uniform :wink:

PS. random.uniform(-1,1) performes 1.5 times slower than 2*random.random()-1.0

Python is weird sometimes :wink:

import random,time

start=time.time()
nr=0
while 1:
    random.uniform(-1,1)
    nr+=1
    if time.time()-start>1:
        print nr
        break
    
start=time.time()
nr=0
while 1:
    2*random.random()-1.0
    nr+=1
    if time.time()-start>1:
        print nr
        break