If I understand your use case correctly, this should work:
a = torch.randn(7)
print(a)
> tensor([ 1.1022, -0.3638, -0.4358,  0.2048,  1.3897, -2.2341, -0.3528])

idx = torch.randperm(a.size(0))
print(idx)
> tensor([5, 6, 0, 2, 4, 3, 1])

b = a[idx]
print(b)
> tensor([-2.2341, -0.3528,  1.1022, -0.4358,  1.3897,  0.2048, -0.3638])

c = torch.zeros_like(a)
c[idx] = b
print(c)
> tensor([ 1.1022, -0.3638, -0.4358,  0.2048,  1.3897, -2.2341, -0.3528])

print((c == a).all())
> tensor(True)