提问:随机产生 16位 字母加数字字符 VB.NET
TRTRTRTR
------解决方案-------------------- ' ' ' <summary>
' ' ' 密码生成
' ' ' </summary>
' ' ' <param name= "intLength "> 密码长度 </param>
' ' ' <remarks> </remarks>
Public Function RandomPasswd(ByVal intLength As Integer) As String
Dim strPasswd As String = " "
Dim intNum As Integer = 0
Dim objRandom As Random = New Random
For i As Integer = 0 To intLength - 1
intNum = objRandom.Next(3)
If intNum = 0 Then
strPasswd += Chr(objRandom.Next(10) + 48).ToString()
ElseIf intNum = 1 Then
strPasswd += Chr(objRandom.Next(26) + 65).ToString()
Else
strPasswd += Chr(objRandom.Next(26) + 97).ToString()
End If
Next
Return strPasswd
End Function