the script is supposed to pick a number between 1-5 and assign it to an array[0...4] while not picking the same number twice
but it does not work, it sometimes picks them right, unfortunately it mostly picks duplicates.
Might be something I'm over looking so hopefully someone might be able spot it.
Script
var a, aS, i, ii, rnum, r1, r2;
aS = argument0;
r1 = argument1;
r2 = argument2;
//Init a global array to store the numbers in or clear it if it exist.
for (a=0; a<aS a+=1)
{
global.calllist[a]=0;
}
for (ii=0; ii<aS; ii+=1)
{
rnum = irandom_range(r1,r2);//Pick an initial random number between r1 - r2.
for (i=0; i<aS; i+=1;)
{
if rnum = global.calllist[i]//Verify that the numbers in the list are not the same.
{
i = 0;
global.skipbacks += 1;//Some debug code to see how many times it took to get a non-duplicate number
rnum = irandom_range(r1,r2);//The number was the same a one in the list pick a new one.
}
}
global.calllist[ii] = rnum; //add the resulting number to the list and loop again
}











