title: python expovariate()
body: <p>I am facing a problem with the random.expovariate() of python.</p>
  
  <p>If I run the following code:
  random.seed(44)
  for i in range(5):
     print random.expovariate(250.0/600.0)</p>
  
  <p>I get the following output,
  1.26037021316
  1.87397995498
  4.75384071801
  0.466542950787
  0.612235449166</p>
  
  <p>However if I use the same piece of code in my actual program which is as follows,</p>
  
  <pre><code>import random
  import simpy
  
  RANDOM_SEED = 44
  CUSTOMERS_TRANS = 250.0
  BUSINESS_TRANS = 50.0
  time_in_bank_customer = 2.0
  time_in_bank_business = 4.0
  arrive_time_bus = []
  arrive_time_cus = []
  wait_time_bus = []
  wait_time_cus = []
  serve_time_bus = []
  serve_time_cus = []
  expo_c=[]
  
  def source_customer(env, counter, Rnd):
      """Source generates customers for customer transaction randomly"""
      for i in range(int(CUSTOMERS_TRANS)):
          env.process(customer(env, 'Customer%s' % (i + 1), counter, time_in_bank_customer, Rnd))
          r=Rnd.expovariate(CUSTOMERS_TRANS / 600.0)
          expo_c.append(r)
          yield env.timeout(r)
  
  def source_business(env, counter, Rnd):
      """Source generates customers for business transaction randomly"""
      for j in range(int(BUSINESS_TRANS)):
          env.process(business(env, 'Business%s' % (j + 1), counter, time_in_bank_business, Rnd))
          yield env.timeout(Rnd.expovariate(BUSINESS_TRANS / 600.0))
  
  def customer(env, name, counter, time_in_bank_customer, Rnd):
      """Customer arrives, is served and leaves."""
      arrive = env.now
      arrive_time_cus.append((name, arrive))
      print('%7.4f %s: Here I am' % (arrive, name))
      with counter.request() as req:
          yield req
          # patience = random.uniform(MIN_PATIENCE, MAX_PATIENCE)
          # Wait for the counter or abort at the end of our tether
          wait = env.now - arrive
          wait_time_cus.append((name,wait))
          # We got to the counter
          print('%7.4f %s: Waited %6.3f' % (env.now, name, wait))
          tib = Rnd.expovariate(1.0 / time_in_bank_customer)
          while tib &lt; 0.5 or tib &gt; 8:
              tib = Rnd.expovariate(1.0 / time_in_bank_customer)
          serve_time_cus.append((name,tib))
          yield env.timeout(tib)
          print('%7.4f %s: Finished' % (env.now, name))
  
  def business(env, name, counter, time_in_bank_business, Rnd):
      """Customer arrives, is served and leaves."""
      arrive = env.now
      arrive_time_bus.append((name, arrive))
      print('%7.4f %s: Here I am' % (arrive, name))
      with counter.request() as req:
          yield req
          # Wait for the counter or abort at the end of our tether
          wait = env.now - arrive
          wait_time_bus.append((name,wait))
          # We got to the counter
          print('%7.4f %s: Waited %6.3f' % (env.now, name, wait))
          tib = Rnd.expovariate(1.0 / time_in_bank_business)
          while tib &lt; 1 or tib &gt; 15:
          tib = Rnd.expovariate(1.0 / time_in_bank_business)
          serve_time_bus.append((name,tib))
          yield env.timeout(tib)
          print('%7.4f %s: Finished' % (env.now, name))
  
  # Scenario 1
  def main():
  
      env = simpy.Environment()
      Rnd = random.Random(44)
      counter = simpy.Resource(env, capacity=1)
      env.process(source_customer(env, counter, Rnd))
      env.process(source_business(env, counter, Rnd))
      env.run()
      l = len(list(filter((lambda (x, y): y &lt; 5), wait_time_cus))) + len(list(filter((lambda (x, y): y &lt; 5), wait_time_bus)))
      print ('Number of processes that waited &lt; 5 min = %s' % (l))
      # len(l) -&gt; 8
      print arrive_time_bus
      print arrive_time_cus
      print wait_time_bus
      print wait_time_cus
      print serve_time_bus
      print serve_time_cus
      print expo_c
  
  if __name__ == "__main__": main()
  </code></pre>
  
  <p>I get a different expo_c- which is essentially the output of the same lines.</p>
  
  <p>I am using the same seed yet the sequence generated by expovariate() differs. How do I ensure the same sequence be generated in my actual program?</p>