Google Search Results
Sometimes we need to generate a random string to use in our tests. The following code generates a random string of alpha characters. You can extend the function to generate additional strings.
Function RandomString( ByVal strLen )
Dim str
Const LETTERS = "abcdefghijklmnopqrstuvwxyz0123456789"
For i = 1 to strLen
str = str & Mid( LETTERS, RandomNumber( 1, Len( LETTERS ) ), 1 )
Next
RandomString = str
End Function
Posted in VBScript

daniva




April 28th, 2008 at 7:43 am
You can get a similar result using the “String” function and the Character Set, as follows:
Function RandString(iLen)
For i=1to iLen
sRandStr=sRandStr&String(1,RandomNumber(65,90))
Next
RandString=sRandStr
End Function
April 29th, 2008 at 1:36 am
Yes….another solution.