def __init__(self, scale, pre=10):
"""
This class holds a queue of times drawn from an exponential
distribution with a specified scale.
Arguments:
- scale: The scale parameter for the exponential distribution.
- pre: Predefined size of the queue. Default=10
"""
self.scale = scale
self.pre = pre
self.queue = SimpleQueue(maxsize=pre + 1)
self.v_put = vectorize(self.queue.put_nowait)
#the exponential dist is not defined for a rate of 0
#therefore if the rate is 0 (scale is None then) huge times are set
if self.scale in [None, 0]:
self.scale = 0
self.draw_fct = no_mut
else:
self.draw_fct = random.exponential
#fillup the queue
self.fillup()
# there was: (new version compatible with pickeling see method below)
self.v_get = vectorize(self.get_val)
评论列表
文章目录