This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def quickSortMath(values): | |
if len(values)<=1: | |
return values | |
if len(values)==2: | |
if values[1]<values[0]: | |
values[0],values[1]=values[1],values[0] | |
return values | |
pivot=min(values)+(sum(values)/len(values)) | |
print pivot | |
less=[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(1,17): | |
square=i^2 | |
print 247-square |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy.random as nprnd | |
from time import clock | |
def r_step_generator(lo, hi): | |
num = lo | |
diff = hi - lo | |
while True: | |
num += nprnd.randint(0, diff) | |
if num < hi: | |
yield num |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy.random as random | |
from time import clock | |
def r_step_generator(lo, hi): | |
num = lo | |
diff = hi - lo | |
while True: | |
num += random.randint(0, diff) | |
if num < hi: | |
yield num |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy.random as random | |
from time import clock | |
N=100000000 | |
u=range(0,N) | |
x=random.randint(0,N,N/100) | |
y=0 | |
for i in xrange(0,N,random.randint(0,N/100)): | |
if i>len(u): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy.random as random | |
N=100000000 | |
u=[] | |
for y in range (0,N): | |
u.append(y) | |
print 'done' | |
x=0 | |
while x<len(u): | |
x+=random.randint(1,N) |