Here is a quick way to generate a random set of hexadecimal digits. Say you are setting up encryption for your Wireless Router traffic, or you need it for some other type of encryption. This provides an easy way to ensure that it is completely random.
Private Sub ShowRandomHexadecimalDigits()
Dim random() As Byte = New Byte(1024) {}
'RNGCryptoServiceProvider is an implementation of an RNG
Dim rng As New System.Security.Cryptography.RNGCryptoServiceProvider
rng.GetNonZeroBytes(random) ' bytes in random are now random
For i As Integer = 0 To random.Length - 1
Select Case random(i)
Case 48 To 57, 65 To 70, 97 To 102
Response.Write(ChrW(random(i)).ToString().ToLower())
End Select
Next
End Sub