code:
function CDSorter($s, $m)
Dim $x, $, $b
do
$ = split($s,",")
do
$b=0.
Dim $z
for $x=0 to ubound($)
if $[$x]
$b = $b + $[$x]
$z=$z+","+($x+1)
endif
next
$[RND($x-1)]=0
$CDSorter=substr($z,2)
until $b < $m
until $b > $m-1
endfunction

code:
Average CD Length = 44.45
Average Gap = 0.55
Average Gap [%] = 1.22

KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_cd.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium III
Speed = 848 MHz
Memory = 511 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: CD Sorter
Processing Start = 2003/03/15 21:53:05.731
Processing End = 2003/03/15 21:53:22.948
Duration = 0000/00/00 00:00:17.217
# Loops = 1
# Processed CDs = 12
# Valid CDs = 12
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 192

Thank you for participating in KiXtart Golf!

_________________________
Home page: http://www.kixhelp.com/hb/