Skip to content

Commit

Permalink
Added fallback to randInt when min and max are the same
Browse files Browse the repository at this point in the history
  • Loading branch information
Chomp committed Dec 10, 2024
1 parent be31f72 commit 90b6f28
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions project/src/utils/RandomUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ export class RandomUtil {
* @returns A random integer within the specified range.
*/
public randInt(low: number, high?: number): number {
if (low === high) {
return low;
}

if (typeof high !== "undefined") {
return crypto.randomInt(low, high);
}
Expand Down

0 comments on commit 90b6f28

Please sign in to comment.