MCPcopy Index your code
hub / github.com/dubinc/dub / generateRandomString

Function generateRandomString

apps/web/lib/api/utils/generate-random-string.ts:3–14  ·  view source on GitHub ↗
(length: number)

Source from the content-addressed store, hash-verified

1import { randomBytes } from "crypto";
2
3export function generateRandomString(length: number): string {
4 const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
5 const randomBytesArray = randomBytes(length);
6 let result = "";
7
8 for (let i = 0; i < length; i++) {
9 const randomIndex = randomBytesArray[i] % charset.length;
10 result += charset[randomIndex];
11 }
12
13 return result;
14}

Callers 9

createProgramFunction · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
POSTFunction · 0.90
route.tsFile · 0.90
POSTFunction · 0.90
POSTFunction · 0.90
POSTFunction · 0.90
POSTFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…