We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10b3689 commit efc11f1Copy full SHA for efc11f1
src/mersenne.ts
@@ -5,6 +5,14 @@ export class Mersenne {
5
6
constructor() {
7
this.gen.init_genrand(new Date().getTime() % 1000000000);
8
+
9
+ // Bind `this` so namespaced is working correctly
10
+ for (const name of Object.getOwnPropertyNames(Mersenne.prototype)) {
11
+ if (name === 'constructor' || typeof this[name] !== 'function') {
12
+ continue;
13
+ }
14
+ this[name] = this[name].bind(this);
15
16
}
17
18
rand(max?: number, min?: number) {
0 commit comments