Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import random
  2.  
  3. class Probability(object):
  4. """docstring for Probability"""
  5. def __init__(self, n, p, nh, nd):
  6. super(Probability, self).__init__()
  7. self.n = n
  8. self.p = p
  9. self.nh = nh
  10. self.nd = nd
  11. self.peopleInHotel = [[[] for x in range(nd)] for y in range(nh)]
  12.  
  13. # n = 10000 p = 0.1 nh = 100 nd = 100
  14.  
  15. def generateData(self):
  16. for x in range(0,self.n):
  17. for y in range(0,self.nd):
  18. if random.random() < self.p:
  19. self.peopleInHotel[y,random.randrange(self.nh)].a x;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement