Joe Strazzere - All Things Quality

Visit my new blog at http://strazzere.blogspot.com/


December 1, 2005 - WinTask - RandString$

Posted in WinTask

'
' RandString$ - Generate a string of a given length containing random characters
'

' Author: Joe Strazzere

'
' Syntax:
'   ret$=RandString$()
'
' Parameters:
'       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))


<- Last Page :: Next Page ->

About Me

A gathering place for information and ideas about Quality Assurance, Testing, and other useful topics.

Problems cannot be solved by the same level of thinking that created them. - A. Einstein

Search This Site

Translate This Site

RSS Feed

Subscribe

Twitter

@jstrazzere

Categories

Life
QA
Sports
Tools
WinTask
Work in General

What I'm Reading Now