REFACTOR: Remove duplicate random alphanumeric string functions (#2601)

This commit is contained in:
catloversg
2026-03-27 11:49:20 +07:00
committed by GitHub
parent fdd6d65c25
commit 3d5079a4e6
4 changed files with 4 additions and 24 deletions
+1 -9
View File
@@ -11,6 +11,7 @@ import { BaseServer } from "../Server/BaseServer";
import { getRandomIntInclusive } from "../utils/helpers/getRandomIntInclusive";
import { ContractFilePath, resolveContractFilePath } from "../Paths/ContractFilePath";
import { clampNumber } from "../utils/helpers/clampNumber";
import { getRandomAlphanumericString } from "../utils/StringHelperFunctions";
export function tryGeneratingRandomContract(numberOfTries: number): void {
/**
@@ -213,15 +214,6 @@ function getRandomServer(): BaseServer | null {
return randServer;
}
function getRandomAlphanumericString(length: number) {
const alphanumericChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let result = "";
for (let i = 0; i < length; ++i) {
result += alphanumericChars.charAt(Math.random() * alphanumericChars.length);
}
return result;
}
/**
* This function will return null if the randomized name collides with another contract's name on the specified server.
* Callers of this function must return early and not generate a contract when it happens. It likely happens when there