Solved by viperit in post #2 
              
              
                I have solved this. Just add sampler.set_epoch(e) after  while e < 2:, just like: 
while e < 2:
    t = 0
    sampler.set_epoch(e)
    for data in rand_loader:
        print(data)
    e+=1