Advertisement
TizzyT

RandomHexString -TizzyT

Jul 22nd, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.40 KB | None | 0 0
  1.     Public Shared Function RandomHexString(ByVal Length As Integer, Optional ByVal Rand As Random = Nothing) As String
  2.         Dim RND As Random = If(Rand, New Random), Bytes(Length / 2) As Byte : RND.NextBytes(Bytes)
  3.         Do
  4.             RandomHexString = BitConverter.ToString(Bytes).Replace("-", "").Substring(0, Length)
  5.         Loop While SystemClients.ContainsKey(RandomHexString)
  6.     End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement