From 90b6f28f31e406dbf479339b41148ebf14814d0a Mon Sep 17 00:00:00 2001 From: Chomp Date: Tue, 10 Dec 2024 00:09:43 +0000 Subject: [PATCH] Added fallback to `randInt` when min and max are the same --- project/src/utils/RandomUtil.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/project/src/utils/RandomUtil.ts b/project/src/utils/RandomUtil.ts index 86f6e06a..1e07f269 100644 --- a/project/src/utils/RandomUtil.ts +++ b/project/src/utils/RandomUtil.ts @@ -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); }