1) here's my fixed version for random(a,b) with arrays :-)
that's only "one possible" approach for this task and this works fine here..
'
'random test with arrays by frankolinox for oxygenbasic, 11.april.2013
'
print "..new random(a,b) test follows.."
'-----------------------// test // ------------------
function rando(sys*max,sys*min) as long
'------------- max
sys p=@max
rdtsc
cdq
idiv max
cmp edx, 0
jge after
neg edx
.after:
mov edx,p
return [edx+4] 'max 'that's I fixed ;)
'------------- min
sys k=@min
rdtsc
cdq
idiv min
cmp edx, 0
jge after
neg edx
.after:
mov edx,k
return [edx+4]
end function
indexbase 0
sys aa[12]={100,200,300,400,500,600,700,800,900,1000,1100,1200}
sys ab[31]={10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}
print "test random function with arrays"
print "ok"
print rando aa[2] ,aa[4] 'result: 400 for indexbase 0
print "ok2"
print rando ab[3] ,ab[5] 'result: 14 for indexbase 0
print "ok3"
2) I am not sure, but I think that's peter example serves with no different values as random function should do. output gives in that example only first parameter back and not different (random) values.
best regards, frank