Skip to content

Commit

Permalink
adding a user for each shop
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Attenberg committed Sep 28, 2012
1 parent aad0421 commit daf36bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ClassTwoNotes/shop.py
@@ -1,9 +1,10 @@
import json

class Shop:
def __init__(self, id, name, listings = dict()):
def __init__(self, id, name, user, listings = dict()):
self.id = id
self.name = name
self.user = user
self.listings = listings

def addListing(self, listing, quantity = 1):
Expand Down
13 changes: 9 additions & 4 deletions ClassTwoNotes/shopGenerator.py
Expand Up @@ -2,19 +2,24 @@
import string
import shop

listings = range(50000)
listings = range(1,50000)
random.shuffle(listings)

users = range(1,10000)
random.shuffle(users)


for i in range(50000):
if len(listings) == 0:
break
id = i+1
name_size = random.randrange(10, 180)
name = ''.join(random.choice(string.ascii_uppercase + " ") for x in range(name_size))

s = shop.Shop(id, name)
num_listings = int(round(random.lognormvariate(0, 5)))

user = users.pop()

s = shop.Shop(id, name, user)
num_listings = int(round(random.lognormvariate(0, 5))) + 1

for j in range(num_listings):
if len(listings) > 0:
Expand Down

0 comments on commit daf36bb

Please sign in to comment.