@thi.ng/random
Version:
Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation
20 lines (19 loc) • 341 B
JavaScript
import { ARandom } from "./arandom.js";
class WrappedRandom extends ARandom {
constructor(rnd) {
super();
this.rnd = rnd;
}
float(norm = 1) {
return this.rnd() * norm;
}
norm(norm = 1) {
return (this.rnd() - 0.5) * 2 * norm;
}
int() {
return this.rnd() * 4294967296 >>> 0;
}
}
export {
WrappedRandom
};