range-unique-sampler
v1.0.0
Published
Sample random unique integers within a range.
Downloads
2
Readme
range-unique-sampler
Sample random unique integers within a range.
Usage
import uniqueSampler from 'range-unique-sampler';
// Sample integers in range 100 (inclusive) - 500 (exclusive).
const sample = uniqueSampler(100,500);
sample() // 123
sample() // x:[100-499] \ 123
// Sample 50 unique integers 0-999.
const samples = Array.from({length: 50}, uniqueSampler(0,1000))