Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Looking for a pygame community? fb.com/groups/pygame
- # Any skill level can join!
- import time
- import math
- import random
- WIDTH = 1280
- HEIGHT = 720
- x1 = random.randint(0, WIDTH)
- y1 = random.randint(0, HEIGHT)
- x2 = random.randint(0, WIDTH)
- y2 = random.randint(0, HEIGHT)
- x = x1 - x2
- y = y1 - y2
- cycles = 10000000
- start = time.time()
- for i in xrange(cycles):
- #distance = math.hypot(x, y)
- distance = x * x + y * y
- end = time.time()
- duration = end - start
- print "Duration: {0}".format(duration)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement