Random sampling in Phobos

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Tue Apr 17 08:26:09 PDT 2012


Hello,

Just checking, since my earlier message on this subject[1] seems to have been 
lost in the ether.

I've been looking at std.random's implementation of random sampling, and I think 
there are some improvements that can be made.

The simple way is just to tweak the RandomSample struct to use a more 
sophisticated algorithm that scales with sample size instead of input data size. 
  I think it should be fairly easy to provide a patch based on the code I've 
already written.

The more complicated way would be to separate out the random selection process 
into several different structs/classes, so that it's possible to do sampling 
without having to have the input data actually loaded in memory.  Again, I think 
I can provide code for this, but I'd like to discuss the design and requirements 
before jumping in.

Anyone interested? :-)

Thanks and best wishes,

     -- Joe

--------
[1] 
http://forum.dlang.org/thread/mailman.1737.1334433366.4860.digitalmars-d@puremagic.com


More information about the Digitalmars-d mailing list