def sample(self, seed: int, n_samples: int) -> InputsLoader:
        """
        Sample from the inputs loader, with replacement.

        Parameters
        ----------
        seed: int
            Random seed.
        n_samples: int
            Number of samples.

        Returns
        -------
        InputsLoader
            An inputs loader made of the sampled inputs.
        """

        def fun():
            rng = np.random.default_rng(seed)
            count = 0

            while True:
                for inputs in self:
                    if count == n_samples:
                        break
                    idx = rng.choice(2, inputs.shape[0]).astype("bool")
                    inputs = inputs[idx]
                    if count + inputs.shape[0] > n_samples:
                        inputs = inputs[: n_samples - count]
                    count += inputs.shape[0]
                    if inputs.shape[0] > 0:
                        yield inputs

                if count == n_samples:
                    break

        return self.from_callable_iterable(fun)

        Sample from the inputs loader, with replacement.

        Parameters
        ----------
        seed: int
            Random seed.
        n_samples: int
            Number of samples.

        Returns
        -------
        InputsLoader
            An inputs loader made of the sampled inputs.
        
fortuna/data/loader/array_loaders.py