On 2011-02-02 16:32:25 +0100, Andrei Alexandrescu said:

randomSample is designed to subsample a large stream in constant space and without needing to scan the entire stream in order to output the first element.

Sure. I was just thinking that you could have a version for the cases where there was no end in sight :)

I used in in my dissertation where e.g. I had to select 100K samples from a stream of many millions.

Cool.

Having a reservoir sample available would be nice. I'd be thrilled if you coded up a reservoirSample(r, n) function for addition to std.random.

Seems Simen beat me to it :)

--
Magnus Lie Hetland
http://hetland.org

Reply via email to