def get_random_perm(self, index: int) -> tuple[torch.Tensor, torch.Tensor]:
        """Generate random permutation and its inverse for given input index.

        Args:
            index (int): Index of input tensor.

        Returns:
            tuple[torch.Tensor, torch.Tensor]: Permutation and inverse permutation tensors.
        """
        perm = np.random.default_rng(self.seed).permutation(self.in_channels[index])
        perm_inv = np.zeros_like(perm)
        for idx, permutation in enumerate(perm):
            perm_inv[permutation] = idx

        perm = torch.LongTensor(perm)
        perm_inv = torch.LongTensor(perm_inv)
        return perm, perm_inv
Generate random permutation and its inverse for given input index.

        Args:
            index (int): Index of input tensor.

        Returns:
            tuple[torch.Tensor, torch.Tensor]: Permutation and inverse permutation tensors.
        
src/anomalib/models/image/csflow/torch_model.py