Skip to content

Commit 23a262a

Browse files
refactor: convert mersenne into a class (#530)
1 parent 03c3d11 commit 23a262a

File tree

2 files changed

+163
-114
lines changed

2 files changed

+163
-114
lines changed

src/mersenne.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class Mersenne {
77
private gen = new Gen();
88

99
constructor() {
10-
this.gen.init_genrand(new Date().getTime() % 1000000000);
10+
this.gen.initGenrand(new Date().getTime() % 1000000000);
1111

1212
// Bind `this` so namespaced is working correctly
1313
for (const name of Object.getOwnPropertyNames(Mersenne.prototype)) {
@@ -36,7 +36,7 @@ export class Mersenne {
3636
max = 32768;
3737
}
3838

39-
return Math.floor(this.gen.genrand_real2() * (max - min) + min);
39+
return Math.floor(this.gen.genrandReal2() * (max - min) + min);
4040
}
4141

4242
/**
@@ -50,7 +50,7 @@ export class Mersenne {
5050
throw new Error('seed(S) must take numeric argument; is ' + typeof S);
5151
}
5252

53-
this.gen.init_genrand(S);
53+
this.gen.initGenrand(S);
5454
}
5555

5656
/**
@@ -66,6 +66,6 @@ export class Mersenne {
6666
);
6767
}
6868

69-
this.gen.init_by_array(A, A.length);
69+
this.gen.initByArray(A, A.length);
7070
}
7171
}

0 commit comments

Comments
 (0)