@vitalets/random-select
v0.1.6
Published
Select random items from list without repeats
Downloads
6
Readme
random-select
Select random items from list without repeats.
Installation
npm i @vitalets/random-select
Usage
import { RandomSelect } from '@vitalets/random-select';
const rs = new RandomSelect();
function selectItem() {
return rs.select([ 1, 2, 3 ]);
}
const item1 = selectItem(); // any value from array
const item2 = selectItem(); // any value from array, except item1
const item3 = selectItem(); // any value from array, except item1 and item2
const item4 = selectItem(); // any value from array, except item3 (new round)
License
MIT @ Vitaliy Potapov