Algorithms, Sampling.
self.seed is not None: np.random.seed(self.i * self.seed) # fill up to k elements first if len(self.sample) < self.k: self.sample.append(item) else: # same code that we saw before if np.random.rand() <= self.k / self.i: idx = np.random.choice(self.k) self.sample[idx] = item def show(self) ->