code: def stochastic_choice(machines):
      
      if len(machines) < 4:
          return random.choice(machines)
  
      r = random.random()
      if r < 0.5:
          return random.choice(machines[:len(machines)/4])
      elif r < 0.75:
          return random.choice(machines[:len(machines)/2])
      else:
          return random.choice(machines)
docs: Stochastically choose one random machine distributed along their
      scores.