0.1.6 • Published 3 years ago

@vitalets/random-select v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

0.1.6

3 years ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago