1.0.2 • Published 4 years ago

fukubiki v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

fukubiki

sampling without replacement.

Example Usage

yarn add fukubiki
import Fukubiki from 'fukubiki';

const fukubiki = new Fukubiki(3);

fukubiki.select(); // => 2
fukubiki.select(); // => 0
fukubiki.select(); // => 1
fukubiki.select(); // => null

fukubiki.reset();

fukubiki.select(); // => 0
fukubiki.select(); // => 2
fukubiki.select(); // => 1
fukubiki.select(); // => null

Option

callback

import Fukubiki from 'fukubiki';

const fukubiki = new Fukubiki(3, {
  callback: () => {
      console.log('finish!');
  }
});

fukubiki.select(); // => 1
fukubiki.select(); // => 0
fukubiki.select(); // => 2 and 'finish!'

autoReset

import Fukubiki from 'fukubiki';

const fukubiki = new Fukubiki(3, {
  autoReset: true
});

fukubiki.select(); // => 0
fukubiki.select(); // => 2
fukubiki.select(); // => 1
fukubiki.select(); // => 1
fukubiki.select(); // => 0
fukubiki.select(); // => 2