i take it you want to jumble a string of letters?
what i would do first is randomize the timer:
randomize timer()
next i would get the string:
input "Enter a string:",a$
and get the length of the string:
string_length=len(a$)
and then make an array of the letters and a flag like so:
type letter_type
char$ as string
exist as boolean
endtype
dim letter(string_length) as letter_type
i'd then fill the array with the letters of the string.
after that i would make a blank string and add a random letter that doesn't exist in the new string, add it to the string, and then change the flag so the same letter isn't randomly picked again:
s$=""
for l=1 to string_length
letter(l).exist=0
next l
`repeat the loop for each letter
for l=1 to string_length
`get random letters until one is found that hasn't been added yet
repeat
n=rnd(string_length-1)+1
until letter(n).exist=0
`once a letter is found, add it
letter(n).exist=1
s$=s$+letter(n).char$
next l
all this works in this snippet:
sync on
sync rate 0
cls
sync
randomize timer()
input "Enter the string to jumble:",a$
string_length=len(a$)
type letter_type
char$ as string
exist as boolean
endtype
dim letter(string_length) as letter_type
s$=""
for l=1 to string_length
letter(l).exist=0
letter(l).char$=mid$(a$,l)
next l
`repeat the loop for each letter
for l=1 to string_length
`get random letters until one is found that hasn't been added yet
repeat
n=rnd(string_length-1)+1
until letter(n).exist=0
`once a letter is found, add it
letter(n).exist=1
s$=s$+letter(n).char$
next l
print s$
sync
wait key
-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.