well, needed to go pretty far and this still is not perfect...
code:
function CDSorter($w, $)
Dim $x, $b
do
if $b<$ $x = split($w+",",",") endif
$b=0.4999
Dim $z,$q,$
for each $q in $x
$=1+$
if $q
$b = $b + $q
$z=$z+","+$
endif
next
$x[RND($-1)]=0
$CDSorter=substr($z,2)
until $=$b
endfunction

it makes the assumption that ppl do not give msecs as input.
only then it is fully trustable.

quote:

Average CD Length = 44.55
Average Gap = 0.45
Average Gap [%] = 1.00

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

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium III
Speed = 797 MHz
Memory = 375 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: CD Sorter
Processing Start = 2003/03/18 07:09:33.271
Processing End = 2003/03/18 07:09:46.079
Duration = 0000/00/00 00:00:12.808
# Loops = 1
# Processed CDs = 15
# Valid CDs = 15
# Full CDs = 2
KiXGolf Result = Valid CD Filling
KiXGolf Score = 188

Thank you for participating in KiXtart Golf!

_________________________
!

download KiXnet