Sub RandomString(Length As Int, LowerCase As Boolean, UpperCase As Boolean, Numbers As Boolean, AdditionalChars As String) As String
Dim source As String
If LowerCase = True Then
source = source &"abcdefghijklmnopqrstuvwxyz"
End If
If UpperCase = True Then
source = source &"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
End If
If Numbers = True Then
source = source &"0123456789"
End If
If AdditionalChars.Length > 0 Then
source = source&AdditionalChars
End If
Dim SB As StringBuilder
SB.Initialize
For i = 1 To Length
Dim r As Int = Rnd(0,source.Length)
SB.Append(source.SubString2(r,r+1))
Next
Return SB.ToString
End Sub