code: def random_filter(objects, reduction_factor, seed=42):
      
      assert 0 < reduction_factor <= 1, reduction_factor
      rnd = random.Random(seed)
      out = []
      for obj in objects:
          if rnd.random() <= reduction_factor:
              out.append(obj)
      return out
docs: Given a list of objects, returns a sublist by extracting randomly
      some elements. The reduction factor (< 1) tells how small is the extracted
      list compared to the original list.