Public Function RandomString(ByVal length As Integer) As String
Dim rd As New Random(Convert.ToInt32(DateTime.Now.Ticks Mod
Integer.MaxValue))
Dim st(length - 1) As Byte
Dim i As Integer
For i = 0 To st.Length - 1
If rd.Next(0, 2) = 0 Then
st(i) = CByte(rd.Next(65, 91))
Else
st(i) = CByte(rd.Next(97, 123))
End If
Next
Return Encoding.Default.GetString(st)
End Function
"Materialised" <ma**********@privacy.net> wrote in message
news:42*************@individual.net...
Hi All,
I am looking for a way to generate a 8 character random string. The range
of characters can be from a-z, A-Z. Does anyone know a quick and efficient
way of doing this?
Regards
Mick