The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
import { randomBytes } from "crypto";
export function generateRandomString(length: number): string {
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const randomBytesArray = randomBytes(length);
let result = "";
for (let i = 0; i < length; i++) {
const randomIndex = randomBytesArray[i] % charset.length;
result += charset[randomIndex];
}
return result;
}