Select is a JavaScript library for advanced probability sampling. It's fast and works on any device with a modern browser. It's written and maintained by Anton Grafström. Select contains implementations of many different sampling methods such as

  • Simple random sampling (with and without replacement)
  • Systematic sampling (with and without initial randomization of order)
  • pps with replacement (independent random sampling with replacement)
  • Poisson sampling (independent random sampling without replacement)
  • Conditional Poisson sampling
  • Pareto sampling
  • Sampford sampling
  • Brewer's method
  • Pivotal method (random)
  • Local pivotal method (for selecting well spread / spatially balanced samples)
  • Spatially correlated Poisson sampling (for selecting well spread / spatially balanced samples)
  • Cube method (balanced sampling)
  • Local Cube method (well spread and balanced sampling)

The easiest way to use Select is to use the workshop provided at this page. The workshop runs entierly in the browser. Feel free to do long simulations, it will not (at least it should not) hang the browser since everything runs inside a web worker. However, you will need a modern browser that has support for web workers. A recent version of Firefox, Chrome, Safari or Opera is recommended. The workshop is not part of the free (MIT-licensed) libraries, but it is free to use at this webpage.

Keep in mind that Select is and will be a work in progress. Methods will be added, removed or renamed as I see fit. I work on Select as a hobby on my spare time.


The distributions library used in the workshop builds upon distributions.js by Kyle Siegrist and others for the project Virtual Laboratories in Probability and Statistics. The license of their work is Creative Commons Licence.


If you have any comments on the libraries, especially if you have found a bug, please send an email to anton.grafstrom@gmail.com.

Other interesting math/statistics JavaScript projects