Private _mGlobleString As String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Private Function GetRandomString(length As Integer) As String
Dim b As Byte() = New Byte(3) {}
New System.Security.Cryptography.RNGCryptoServiceProvider().GetBytes(b)
Dim r = New Random(BitConverter.ToInt32(b, 0))
Dim s As String Is Nothing
Dim i = 0
While i < length
s += _mGlobleString.Substring(r.[Next](0, 35), 1)
System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
End While
Return s
End Function
Private Function GetRandomString(ByVal length As Integer) As String
Dim mGlobleString As String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Dim b As Byte() = New Byte(3) {}
Dim rng As System.Security.Cryptography.RNGCryptoServiceProvider = New System.Security.Cryptography.RNGCryptoServiceProvider()
rng.GetBytes(b)
Dim r = New Random(BitConverter.ToInt32(b, 0))
Dim s As String = Nothing
Dim i = 0
While i < length
s = s & mGlobleString.Substring(r.[Next](0, 35), 1)
System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
End While
Return s
End Function
[本日志由 tiancao1001 于 2020-06-03 07:58 PM 编辑]
暂时没有评论