Hacker News new | ask | show | jobs
by throwaway_yy2Di 3726 days ago
This works, and is so much simpler.

It's not quite the same problem though; the algorithm described returns samples in sequential order. They mention performance reasons for this (C-f "tape sampling"). It also has the limitation that you need to know the sample size in advance.

1 comments

MLCG is sequential. No value will be repeated within the period.
"sequential" in the sense that if returned values are i1, i2, ..., in, then 0 <= i1 < i2 < ... < in <= N.

A MLCG will return numbers all over the place; sorting them will take an additional O(n log n) time.

I see.
He means: outputs are sorted.