def initialise_sample(
        x: np.ndarray,
        y: np.ndarray,
        sample_sizes: np.ndarray,
        perturbation_size: np.ndarray,
        perturb_sizes: list[list[int]] | None,
        perturb_starts: list[list[int]] | None,
    ) -> np.ndarray:
        """
        Randomly append bytes at the end of the malware to initialise it, or if perturbation regions are provided,
        perturb those.

        :param x: Array with input data.
        :param y: Labels, after having been adjusted to account for malware which cannot support the full l0 budget.
        :param sample_sizes: The size of the original file, before it was padded to the input size required by MalConv
        :param perturbation_size: Size of the perturbations in L0 terms to put at end of file
        :param perturb_sizes: List of length batch size, each element is in itself a list containing the size
                              of the allowable perturbation region
        :param perturb_starts: List of length batch size, each element is in itself a list containing the start
                               of perturbation region.
        :return x: Array with features to be perturbed set to a random value.
        """
        for j in range(len(x)):
            if y[j] == 1:
                if perturb_sizes is not None and perturb_starts is not None:
                    for size, start in zip(perturb_sizes[j], perturb_starts[j]):
                        x[j, start : start + size] = np.random.randint(low=0, high=256, size=(1, size))
                x[j, sample_sizes[j] : sample_sizes[j] + perturbation_size[j]] = np.random.randint(
                    low=0, high=256, size=(1, perturbation_size[j])
                )

        return x

        Randomly append bytes at the end of the malware to initialise it, or if perturbation regions are provided,
        perturb those.

        :param x: Array with input data.
        :param y: Labels, after having been adjusted to account for malware which cannot support the full l0 budget.
        :param sample_sizes: The size of the original file, before it was padded to the input size required by MalConv
        :param perturbation_size: Size of the perturbations in L0 terms to put at end of file
        :param perturb_sizes: List of length batch size, each element is in itself a list containing the size
                              of the allowable perturbation region
        :param perturb_starts: List of length batch size, each element is in itself a list containing the start
                               of perturbation region.
        :return x: Array with features to be perturbed set to a random value.
        
art/attacks/evasion/pe_malware_attack.py