mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-08 08:37:48 +02:00
REFACTOR: Remove duplicate random alphanumeric string functions (#2601)
This commit is contained in:
@@ -78,7 +78,7 @@ export function containsAllStrings(arr: string[]): boolean {
|
||||
}
|
||||
|
||||
// Generates a random alphanumeric string with N characters
|
||||
export function generateRandomString(n: number): string {
|
||||
export function getRandomAlphanumericString(n: number): string {
|
||||
let str = "";
|
||||
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// Function that generates a random gibberish string of length n
|
||||
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
export function createRandomString(n: number): string {
|
||||
let str = "";
|
||||
|
||||
for (let i = 0; i < n; ++i) {
|
||||
str += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
Reference in New Issue
Block a user