Long rubbish string for test purpose

Post Reply
Henko
Posts: 793
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Long rubbish string for test purpose

Post by Henko »

a$=gen_str$(2000)
print a$ ! print ! print "count= ";len(a$)
end

' function generates a long string for test purposes.
' the string looks like a piece of text, be it in a
' language which has not yet been deciphered.
'
def gen_str$(length)
ko=substr$("10",1,1) ' works for either OPTION BASE 0 or 1
randomize
nwords=length/5.5
kl$="aeiou" ! m$="bcdfghjklmnprstvwz" ! cap=1
for i=1 to nwords
leng=3+rnd(4)
for j=1 to leng
if rnd(1)>.35 then
k=ko+rnd(18) ! b$=substr$(m$,k,k)
if cap then
cap=0 ! b$=capstr$(b$)
end if
a$=a$ & b$
else
k=ko+rnd(5) ! b$=substr$(kl$,k,k)
if cap then
cap=0 ! b$=capstr$(b$)
end if
a$=a$ & b$
end if
next j
if rnd(1)<.10 and tel>3 then
a$=a$ & "." ! cap=1 ! tel=0
else
tel=tel+1
end if
a$=a$ & " "
next i
a$=a$ & "."
gen_str$=a$
end def

Post Reply