Didn't have a change to post this weekend. So here's my code.

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

until $p>$b-1 and $p < $b
$CDSorter = join($a,",")
endfunction

_________________________
Eric