import { randomUUID } from "crypto"; export function getRandomString(minLength = 1, maxLength = 100) { const length = getRandomInt(minLength, maxLength + 1); let result = ''; const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; const charactersLength = characters.length; for (let i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; } export function getRandomInt(min = 0, max = 1000) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive } export function getRandomGuid() { return randomUUID(); } export function getRandomBoolean() { const bools = [true, false]; const index = getRandomInt(0,2); return bools[index]; }