sample-size
v1.0.1
Published
🎲 random pass/fail by sample size
Downloads
5,222
Maintainers
Readme
sample-size
🎲 random pass/fail by sample size
Accepts one decimal fraction
const sample = require('sample-size');
filter(0) // always false
filter(1) // always true
filter(.2) // about 20% true
Usage examples
Report only about 5% of events
sample(.05) && reportEvent();
Sample about half of a list
array.filter(() => sample(.5));