def _sample_seq_start_ind(self, rec_ind=None, class_ind=None):
        """Sample a sequence and return its start index.

        Sample a window associated with a random recording and a random class
        and randomly sample a sequence with it inside. The function returns the
        index of the beginning of the sequence.

        Parameters
        ----------
        rec_ind : int | None
            Index to the recording to sample from. If None, the recording will
            be uniformly sampled across available recordings.
        class_ind : int | None
            If provided as int, sample a window of the corresponding class. If
            None, the class will be uniformly sampled across available classes.

        Returns
        -------
        int
            Index of the first window of the sequence.
        int
            Corresponding recording index.
        int
            Class of the sampled window.
        """
        if class_ind is None:
            class_ind, rec_ind = self.sample_class(rec_ind)

        rec_inds = self.info.iloc[rec_ind]["index"]
        len_rec_inds = len(rec_inds)

        row = self.info.iloc[rec_ind].name
        if not isinstance(row, tuple):
            # Theres's only one category, e.g. "subject"
            row = tuple([row])
        available_indices = self.info_class.loc[row + tuple([class_ind]), "index"]
        win_ind = self.rng.choice(available_indices)
        win_ind_in_rec = np.where(rec_inds == win_ind)[0][0]

        # Minimum and maximum start indices in the sequence
        min_pos = max(0, win_ind_in_rec - self.n_windows + 1)
        max_pos = min(len_rec_inds - self.n_windows, win_ind_in_rec)
        start_ind = rec_inds[self.rng.randint(min_pos, max_pos + 1)]

        return start_ind, rec_ind, class_ind
Sample a sequence and return its start index.

        Sample a window associated with a random recording and a random class
        and randomly sample a sequence with it inside. The function returns the
        index of the beginning of the sequence.

        Parameters
        ----------
        rec_ind : int | None
            Index to the recording to sample from. If None, the recording will
            be uniformly sampled across available recordings.
        class_ind : int | None
            If provided as int, sample a window of the corresponding class. If
            None, the class will be uniformly sampled across available classes.

        Returns
        -------
        int
            Index of the first window of the sequence.
        int
            Corresponding recording index.
        int
            Class of the sampled window.
        
braindecode/samplers/base.py