Not so fast. All I have to do is knock a mere 40 strokes off my score, and I'm right back in it [Big Grin]

code:
  
function CDSorter($a, $b)
dim $c, $, $u,$p, $t
$c = split($a, ",")
$u = ubound($c)
srnd(@TICKS)
do
$ = rnd($u)
$p = -0.5 + $b
redim $a[$]
do
$t = rnd($u)+1
if ascan($a, $t)<0
$p = $p - $c[$t-1]
$a[$] = $t
$=$-1
endif
until $ < 0
until 0=$p
$CDSorter = join($a,",")
endfunction

Notice that if you start at medialength-0.5 and subtract, then you don't have to worry about rounding, -0.5<= n <=0.5 always rounds to 0
_________________________
Eric