M
Morten Snedker
I'm using this for generating passwords. It seems to function okay.
Anything you guys reckon I missed out on?
'** CODE BEGIN
Public Class GeneratePassword
Public Shared Function GeneratePassword(ByVal Length As
Integer, ByVal Complexity As Complexity) As String
Dim characters As String =
"abcdefghijklmnopqrstuvwxyz1234567890"
If Complexity = Complexity.Medium Or Complexity =
Complexity.Complex Then
characters += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
End If
If Complexity = Complexity.Medium Then
characters += "!#%&/()=? "
End If
Dim password As String = ""
Dim random As New Random
For i As Integer = 0 To Length
password += characters.Substring(random.Next(0,
characters.Length - 1), 1)
Next
Return password
End Function
Public Enum Complexity
Simple
Medium
Complex
End Enum
End Class
'** CODE END
Regards /Snedker
Anything you guys reckon I missed out on?
'** CODE BEGIN
Public Class GeneratePassword
Public Shared Function GeneratePassword(ByVal Length As
Integer, ByVal Complexity As Complexity) As String
Dim characters As String =
"abcdefghijklmnopqrstuvwxyz1234567890"
If Complexity = Complexity.Medium Or Complexity =
Complexity.Complex Then
characters += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
End If
If Complexity = Complexity.Medium Then
characters += "!#%&/()=? "
End If
Dim password As String = ""
Dim random As New Random
For i As Integer = 0 To Length
password += characters.Substring(random.Next(0,
characters.Length - 1), 1)
Next
Return password
End Function
Public Enum Complexity
Simple
Medium
Complex
End Enum
End Class
'** CODE END
Regards /Snedker