17 lines
269 B
Python
17 lines
269 B
Python
|
import benchmark
|
||
|
import random
|
||
|
|
||
|
def gcd(a,b):
|
||
|
while a != b:
|
||
|
if a > b:
|
||
|
a = a - b
|
||
|
else:
|
||
|
b = b - a
|
||
|
|
||
|
return a
|
||
|
|
||
|
with benchmark.Timer():
|
||
|
for i in range(10000):
|
||
|
gcd(random.randint(2,10000), random.randint(2,10000))
|
||
|
|