Skip to content

Commit 3741a63

Browse files
authored
🏷️ Mark getState as compulsory on RandomGenerator (#733)
* 🏷️ Mark `getState` as compulsory on `RandomGenerator` * fix tests
1 parent 5d5fe99 commit 3741a63

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/generator/RandomGenerator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface RandomGenerator {
1616
/** Jump current generator */
1717
unsafeJump?(): void;
1818
/** Access to the internal state of a RandomGenerator in a read-only fashion */
19-
getState?(): readonly number[];
19+
getState(): readonly number[];
2020
}
2121

2222
export function unsafeGenerateN(rng: RandomGenerator, num: number): number[] {

test/unit/distribution/internals/UnsafeUniformIntDistributionInternal.spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class NatGenerator implements RandomGenerator {
1919
this.current = (this.current + 1) | 0;
2020
return previousCurrent;
2121
}
22+
getState(): readonly number[] {
23+
throw new Error('Method not implemented.');
24+
}
2225
}
2326

2427
const MAX_RANGE: number = 1000;

0 commit comments

Comments
 (0)