MCPcopy Create free account
hub / github.com/ShouChenICU/FastSend / genDigitCode

Function genDigitCode

server/api/connect.ts:149–164  ·  view source on GitHub ↗
(length: number)

Source from the content-addressed store, hash-verified

147})
148
149function genDigitCode(length: number): string {
150 if (length <= 0) {
151 throw new Error('长度必须大于0')
152 }
153
154 let code = ''
155
156 for (let i = 0; i < length; i++) {
157 // 生成一个0到9之间的随机整数
158 const digit = Math.floor(Math.random() * 10)
159 // 将数字拼接到字符串中
160 code += digit
161 }
162
163 return code
164}

Callers 1

initSendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected