Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Shared Function RandomHexString(ByVal Length As Integer, Optional ByVal Rand As Random = Nothing) As String
- Dim RND As Random = If(Rand, New Random), Bytes(Length / 2) As Byte : RND.NextBytes(Bytes)
- Do
- RandomHexString = BitConverter.ToString(Bytes).Replace("-", "").Substring(0, Length)
- Loop While SystemClients.ContainsKey(RandomHexString)
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement