VB.net 生成随机数的小代码

前端之家收集整理的这篇文章主要介绍了VB.net 生成随机数的小代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

@H_404_1@

Public Shared Function NewPassword() As String@H_404_1@

Dim PasswordParent As String = "0123456789ABCDENGHJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%&*"@H_404_1@

Dim RetVal As String = ""@H_404_1@

Dim Rnd As Random = New Random(System.DateTime.Now.Millisecond) '通过日期产生随机数@H_404_1@

For i As Integer = 0 To 8@H_404_1@

Dim iRandNum As Integer = Rnd.Next(PasswordParent.Length)@H_404_1@

RetVal += PasswordParent(iRandNum) '每次生一个随机数加入数组@H_404_1@

Next i@H_404_1@

Return RetVal@H_404_1@

End Function@H_404_1@ 原文链接:https://www.f2er.com/vb/262195.html

猜你在找的VB相关文章