Skip to content

Rewrite of D's RandomSample to use Vitter's Algorithm D. This is a prototype of the code that eventually made it into D's std.random.

Notifications You must be signed in to change notification settings

WebDrake/RandomSample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This code is a prototype for an improved replacement of the random
sampling functionality in Phobos' std.random module.

The [R,r]andomSampleVitter structs and functions here are a copy of the
corresponding [R,r]andomSample API in std.random, with the underlying
functionality rewritten to use Jeffrey Scott Vitter's Algorithm D
(Vitter 1984, 1987).

Compile and run the program to see a series of benchmarks of the new
algorithm compared to the algorithm currently implemented in Phobos.
Make sure you have the latest development versions of DMD and Phobos
installed first.

To compile, either:

  make

or, if you don't have make installed,

  dmd -O -inline -ofrandomsample randomsample.d

Note that for demonstration purposes it is not recommended to compile
the program without these optimization flags, as otherwise the demo
benchmarks can take an extremely long time to run!

About

Rewrite of D's RandomSample to use Vitter's Algorithm D. This is a prototype of the code that eventually made it into D's std.random.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages