ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` '得到随机字符串 Public Function getRndString(ByVal strKey$, ByVal intSize1%, Optional ByVal intSize2) As String Dim intRnd%, i%, s$, intLen% Randomize If IsMissing(intSize2) Then intRnd = intSize1 ElseIf intSize1 > intSize2 Then MsgBox "第1个参数不能比第2个参数大!", vbExclamation Exit Function ElseIf intSize1 = Val(intSize2) Then intRnd = intSize1 Else intRnd = Int(Rnd * (intSize2 - intSize1 + 1)) + intSize1 End If intLen = Len(strKey) For i = 1 To intRnd s = s & Mid(strKey, Int(intLen * Rnd) + 1, 1) Next getRndString = s End Function '得到随机密码6~12位字符串 Public Function getRndPwd() As String Const C_RNDWORD$ = "abcdefghijklmnopqrstuvwxyz0123456789" getRndPwd = getRndString(C_RNDWORD, 6, 12) End Function ```