"David Eadie" <ha*****@hotmail.com> wrote in message
news:da**************************@posting.google.c om...
G'Day all,
I cant work out how to create a random password generator.
In specific the password (or well the output as a string) needs to be
in the following format:
abc123
So no capitals or other characters, Just the first three being letters
and the last three being numbers in random. Basically im creating a
list if these to write to a text file (I can do that part :-) )
I have googled and come across many examples but none that will help
me.
Any ides?
Dave.
Does this help?
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Randomize()
End Sub
Function GetPWD() As String
Dim sRet As String
sRet = Chr(Int((Asc("z") - Asc("a") + 1) * Rnd + Asc("a")))
sRet = sRet & Chr(Int((Asc("z") - Asc("a") + 1) * Rnd + Asc("a")))
sRet = sRet & Chr(Int((Asc("z") - Asc("a") + 1) * Rnd + Asc("a")))
sRet = sRet & CStr(Int(9 * Rnd()))
sRet = sRet & CStr(Int(9 * Rnd()))
sRet = sRet & CStr(Int(9 * Rnd()))
Return sRet
End Function
It's as simple as you can get (I think) but doesn't guarantee a unique value.
Jim Edgar