'
' RandString$ - Generate a string of a given length containing random characters
'
' Author: Joe Strazzere
'
' Syntax:
' ret$=RandString$(<length>)
'
' Parameters:
' <length> the length of the string to create
'
' Returns ret$
' a string containing random characters
'
Function RandString$(RandStringLength)
local RandStringIndex
local RandStringNumber
local RandStringString$
RandStringIndex = 0
RandStringString$ = ""
While RandStringIndex < RandStringLength
RandStringIndex = RandStringIndex + 1
RandStringNumber=Random(52)
If RandStringNumber < 26 then
RandStringNumber=RandStringNumber+65
else
RandStringNumber=RandStringNumber+71
endif
RandStringString$=RandStringString$+Chr$(RandStringNumber)
Wend
RandString$=RandStringString$
Endfunction
' Examples
MsgBox(RandString$(3))
MsgBox(RandString$(10))