I have dataset 1 and dataset 2 that store in two lists.

list_dataset1

/home/dataset1/1
/home/dataset1/2
/home/dataset1/3
/home/dataset1/4


list_dataset2

/home/dataset2/1
/home/dataset2/2
/home/dataset2/3
/home/dataset2/4

I want to write a custom dataset loader that can shuffle two dataset. For example, the two first epochs, it will return the index likes
dataset1, dataset2
/home/dataset1/1,/home/dataset2/2
/home/dataset1/2,/home/dataset2/3
/home/dataset1/3,/home/dataset2/1
/home/dataset1/4,/home/dataset2/4

dataset1, dataset2
/home/dataset1/2,/home/dataset2/1
/home/dataset1/1,/home/dataset2/3
/home/dataset1/3,/home/dataset2/2
/home/dataset1/4,/home/dataset2/4

So, this is my dataloader
class Mydataloader(data.Dataset):
    def __init__(self, list_dataloader1, list_dataloader2):
         self.list_dataloader1=list_dataloader1
         self.list_dataloader2=list_dataloader2
    def __getitem__(self, index):    
         return self.list_dataloader1[index],self.list_dataloader2[index]
    def __len__(self):
        return len(self.list_dataloader1)

The above script only shuffles the dataloader1, not data loader 2. How can I shuffle both together?