Skip to content

Commit

Permalink
🏷️ Mark getState as compulsory on RandomGenerator (#733)
Browse files Browse the repository at this point in the history
* 🏷️ Mark `getState` as compulsory on `RandomGenerator`

* fix tests
  • Loading branch information
dubzzz authored Sep 24, 2024
1 parent 5d5fe99 commit 3741a63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/generator/RandomGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface RandomGenerator {
/** Jump current generator */
unsafeJump?(): void;
/** Access to the internal state of a RandomGenerator in a read-only fashion */
getState?(): readonly number[];
getState(): readonly number[];
}

export function unsafeGenerateN(rng: RandomGenerator, num: number): number[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class NatGenerator implements RandomGenerator {
this.current = (this.current + 1) | 0;
return previousCurrent;
}
getState(): readonly number[] {
throw new Error('Method not implemented.');
}
}

const MAX_RANGE: number = 1000;
Expand Down

0 comments on commit 3741a63

Please sign in to comment.