I want to fairly select K numbers out of an array of N number. I know that this problem can be solved using Reservoir Sampling but I want to know if this approach is correct too?
1. Generate a random number for every element of the array.
2. Select those numbers in the set of K numbers whose corresponding random number lie in the top(greatest) K random numbers.
Yes, that approach is working. Essentially, you first produce a ranom permutaion of all numbers and then pick the first $k$. While inefficient for many scenarios, this may be a nice and simple method e.g. as a one-liner in SQL - but I'm note sure how well the performance will be even ther (for cases of $n\gg k$).