random
Version:
Seedable random number generator supporting many common distributions.
21 lines • 494 B
JavaScript
import RNG from '../rng';
export default class RNGFunction extends RNG {
constructor(thunk, opts) {
super();
this.seed(thunk, opts);
}
get name() {
return 'function';
}
next() {
return this._rng();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
seed(thunk, _opts) {
this._rng = thunk;
}
clone(_, opts) {
return new RNGFunction(this._rng, opts);
}
}
//# sourceMappingURL=function.js.map