Generating n random but different numbers on the GPU

As the question states, I am looking for a way to do this:

rnd = sorted(random.sample(range(0, 10000), 1000))

I cannot find any implementation of random that can achieve this looking at:

This is my best bet: torch.randperm(10000)[:1000] which isn’t as efficient as it could be, since I generate way more numbers than what I need