News for hackers. Stuff that matters.
Re:Algorithms Every Programmer Should Know: Reservoir Sampling by edc117 on Friday March 06, 2015 @01:39PM (#9158651)
Do you have to make sure to address the scenario where a generated index may possibly not exist in a table (deletion, whatever)? It says nothing about the index being contiguous. This can potentially end up with your algorithm returning less than #{X} if your generated indices don't exist.
Re:Algorithms Every Programmer Should Know: Reservoir Sampling by Veedrac on Friday March 06, 2015 @01:44PM (#9158684)
Just re-sample the ones that "miss". It won't affect the distribution.
Re:Algorithms Every Programmer Should Know: Reservoir Sampling by gearoidoc on Friday March 06, 2015 @01:42PM (#9158674)
You still have to loop over your returned records to verify uniqueness so wouldn't this automatically be solved?