MCPcopy Index your code
hub / github.com/anomalyco/opencode / randomBase62

Function randomBase62

packages/opencode/src/id/id.ts:41–49  ·  view source on GitHub ↗
(length: number)

Source from the content-addressed store, hash-verified

39}
40
41function randomBase62(length: number): string {
42 const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
43 let result = ""
44 const bytes = randomBytes(length)
45 for (let i = 0; i < length; i++) {
46 result += chars[bytes[i] % 62]
47 }
48 return result
49}
50
51export function create(prefix: string, direction: "descending" | "ascending", timestamp?: number): string {
52 const currentTimestamp = timestamp ?? Date.now()

Callers 1

createFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected