10 ms·
You can still use this approach as long as you know the total size upfront, just sort the generated index array and use it to skip elements from your input stre
by detrino 12y ago
You can still use this approach as long as you know the total size upfront, just sort the generated index array and use it to skip elements from your input stream, this will save you from having to generate random numbers for every element.