Rixort

VB random strings

Download all the source code for this project as a single zip file (0.34KB).

modRandomString.bas:

Option Explicit

Public Function RandomString(ByVal LowerBound As Integer, ByVal UpperBound As Integer, ByVal StringLength As Integer) As String

Dim i As Integer

Rnd (1)
Randomize

For i = 1 To StringLength
    RandomString = RandomString & Chr(Int((UpperBound - LowerBound + 1) * Rnd + LowerBound))
Next i

End Function