title: Increasing the loop speed
body: <p>I have 1 million loops to make. Is there anyway of processing this (and python loops in general) faster?</p>
  
  <pre><code>import numpy
  #in a population of 1000 individuals of the same species, one individual has an advantageous mutation
  #before, the average quantity of newborns per each 2 individuals per generation was 2 (no average change in pop)
  
  popN, popM= 999, 1
  period= 1000
  
  reproductionDistN=[0.1, 0.2, 0.41, 0.19, 0.1] #expected value= 1.95
  reproductionDistM=[0.1, 0.2, 0.39, 0.21, 0.1] #expected value= 2.05
  
  def reproduce(pop, reproductionDist):
      newborns=numpy.random.choice(numpy.arange(0,5), p=reproductionDist) #numpy.arange(0,5)=[0, 1, 2, 3, 4]
      pop+=newborns
      return pop
  
  for t in range(period):
      for n in range(popN): popN=reproduce(popN, reproductionDistN)  
      for m in range(popM): popM=reproduce(popM, reproductionDistM) 
  
  print("Population of N:",popN)
  print("Population of M:",popM)
  </code></pre>