by Denis Petrusenko (6 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 29th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) would return a 50 character random string.
Dim t As Integer, v As String, X As Currency
For X = 1 To l
Randomize
t = Int((3 * Rnd) + 1)
If t = 1 Then v = v & Chr(Int((26 * Rnd) + 1) + 96)
If t = 2 Then v = v & Chr(Int((26 * Rnd) + 1) + 64)
If t = 3 Then v = v & Chr(Int((9 * Rnd) + 1) + 48)
Next
RandomString = v
End Function
No comments have been posted about Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) wo. Why not be the first to post a comment about Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) wo.