Skip to content

Instantly share code, notes, and snippets.

@yao2030
Last active December 30, 2015 08:49
Show Gist options
  • Save yao2030/7804841 to your computer and use it in GitHub Desktop.
Save yao2030/7804841 to your computer and use it in GitHub Desktop.
test
import time
import random
class Customer:
def __init__(self, id):
self.id = id
self.foods = []
self.start = time.time()
def choose_foods(self):
self.foods = random_choose(5)
def total_time(self):
return time.time() - self.start
def get_foods(self):
for i in range(len(self.foods)):
def barbecue(self):
for i in range(len(self.foods)):
def random_choose(n):
results = []
for i in range(n):
while True:
x = random.randint(1, 20)
if x not in results:
results.append(x)
break
return results
for i in range(5):
customer = Customer(i)
customer.choose_foods()
print customer.total_time()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment