|
load("win32api");
public function getRandom(in iMin, in iMax, out aRand[]) {
auto iRange, i;
if (iMin < 0 || iMin > iMax || (iMin + iMax)==0)
return -1;
if (int(iMin) != iMin || int(iMax) != iMax)
return -1;
iRange=(iMax-iMin) + 1;
srand(GetTickCount());
for (i=0; i<iRange; i++)
aRand[i] = int(rand()*iRange) + iMin;
return 0;
}
#When used with the following calling code, random output listings were created.
if (getRandom(1,5,aRnd)==E_OK)
{
buf="";
for (i=0; i<10; i++)
buf = buf & " " aRnd[i];
print(buf);
}
texit;
这个也HELP里面的例子 |
|