Algorithm aspect is not my strength, so encountered this problem, record the solution;
At the beginning, the practice is to randomly select one from the random, and then determine whether there are existing lists,
And then repeat, see here, will algorithm students will certainly say this obviously not, just like how many people's birthday is more than 50% of the probability of a day;
So then find some information, see the shuffle algorithm, including a variety of varieties bar.
Here is the solution that I refer to;
For example, there are 300,000 elements of the list, then the first random selection of one; record position is x;
Then the element's last position element is stored in position x, then the element of the last position is deleted;
(here in exchange, it is necessary to determine whether this element was originally the last element);
Then randomly select one of the remaining elements so that it does not repeat;
Swap the last element to reduce the performance impact of the list's overall offset;
Everyone can try;
Random algorithm of 300,000 employees to extract 100,000 employees (shuffle algorithm)