MCPcopy Create free account
hub / github.com/anomalyco/opencode / randomBase62

Function randomBase62

packages/app/src/utils/id.ts:69–77  ·  view source on GitHub ↗
(length: number)

Source from the content-addressed store, hash-verified

67}
68
69function randomBase62(length: number): string {
70 const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
71 const bytes = getRandomBytes(length)
72 let result = ""
73 for (let i = 0; i < length; i += 1) {
74 result += chars[bytes[i] % 62]
75 }
76 return result
77}
78
79function getRandomBytes(length: number): Uint8Array {
80 const bytes = new Uint8Array(length)

Callers 1

createFunction · 0.70

Calls 1

getRandomBytesFunction · 0.85

Tested by

no test coverage detected