Random device
const Device = require('spb14-device');
const random = n => Math.floor(Math.random() * n);
class RandomNatural extends Device {
next (n) {
return super.next(random(n));
}
init (n) {
return super.init(n);
}
}
let die = new RandomNatural(10);
die.get().then(console.log); // '6'
npm install spb14-device
.derive()
MIT License