こんなやりかたも
def f(dex[])
var n = len(dex), tmp[n], index[n]
copy tmp, dex
for i = 0 to n - 1
index[i] = i
next
rsort tmp, index
return index
end
var n=10, dex[n], index[n], i, j
for i = 0 to n - 1: dex[i] = rnd(10): next
index = f(dex)
for i = 0 to n - 1: j = index[i]: ? format$("dex[%d]=%d", j, dex[j]): next