I can't say exactly why I found this so interesting but... here is what I came up with using ArrayPack.

Code:
break on
srnd(@ticks)
$rand=rnd(0)


$r=split("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z")


while ubound($r)>0
$rand = Rnd(ubound($r))
$r[$rand]
$r[$rand]=""
$r=arraypack($r)
loop
$r[0]






Function ArrayPack($array)
dim $loop, $arrTemp[0],$element
If Not VarType($Array) & 8192
Exit(1)
EndIf
$loop = -1
for each $element in $array
if $element > ' '
$loop = $loop + 1
redim preserve $arrTemp[$loop]
$arrTemp[$loop] = $element
endif
next
if ubound($arrTemp) = -1
Exit(2)
Endif
$ArrayPack = $arrTemp
endFunction



OK...so now I have a question. Is there a way to structure the loop so that the last element can be included without it generating an error. Seems that RND(0) is RND(32767), the default.


Edited by Allen (2006-07-26 05:06 AM)