I ran the following command to generate 1 billion random numbers:

```
time shuf -i 1-1000000000 > "SHUF TEST 1"
```

To my surprise it was able to do this in less than 10 mins. I then ran the output file through `uniq -d`

to determine how many of the generated numbers were duplicate, and was again surprised when it turned out to be 0. I also ran the output file through `uniq -u`

and `sort -u`

to confirm these results.

How is it that the `shuf`

command is able to generate a billion random numbers in such a relatively short amount of time, and can I depend on its randomness? Note that I don't need a cryptographically secure random number generator for my needs, just something good enough to always return a unique number.

`to determine how many of the generated numbers were duplicate, and was again surprised when it turned out to be 0`

–`shuf`

does not generate random numbers, it generates randompermutation, random order. With`-i 1-1000000000`

one should expect each integer from this range to appear exactly once. No surprise at all. – Kamil Maciorowski Jun 30 at 17:23n, then randomly switches pairs of numbers. Does it matter if the order is exactly duplicated each time it's run? Some algorithms start the random number generator at the same pint each time. – DrMoishe Pippik Jun 30 at 19:29