Probability, Statistics, Distributed Systems, Software Engineering, Interview Questions.
sample(self): return random.betavariate(self.pos, self.neg) def serve(self): return 1 if random.random() <= self.prob else 0 def new_request(self): x = self.serve() if x == 1: self.num_requests += 1 # Here neg is incremented in case the server starts serving because # we want to sample more of