S is a sorted list of K unique random integers in the range 1..N.
The implementation uses different techniques depending on the ratio
K/N. For small K/N it generates a set of K random numbers, removes
the duplicates and adds more numbers until |S| is K. For a large K/N
it enumerates 1..N and decides randomly to include the number or
not. For example: