code: def filter_by_rand(self, p:float, seed:int=None):
          "Keep random sample of `items` with probability `p` and an optional `seed`."
          if seed is not None: np.random.seed(seed)
          return self.filter_by_func(lambda o: rand_bool(p)f filter_by_rand(self, p:float, seed:int=None):
          "Keep random sample of `items` with probability `p` and an optional `seed`."
          if seed is not None: np.random.seed(seed)
          return self.filter_by_func(lambda o: rand_bool(p))
docs: Keep random sample of `items` with probability `p` and an optional `seed`.