spb14-device
v1.1.0
Published
Random device
Downloads
1
Readme
Device
Random device
Example
const Device = require('spb14-device');
class RandomNatural extends Device {
next (n) {
let i = Math.floor(this.urv * n);
return super.next(i);
}
init (n) {
return super.init(n);
}
}
let die = new RandomNatural(10);
die.get().then(console.log); // '6'
Install
npm install spb14-device
API
Prototype properties
.urv
Uniform random variate
Prototype methods
.get()
.next(index)
.init(...argv)
License
MIT License