Array - similar values. Repost

I’m reposting this because the last thread is cursed. 3 bumps and no answer. :crying:

I have the following code:


objArray = [main.navHead1, main.navHead2, main.navHead3];
for (q=0; q<objArray.length; q++) {
    objArray[q].a = Math.random()*800;
    objArray[q].b = Math.random()*wVar;
    objArray[q].c = Math.random()*hVar;
}

I need to figure out a way to make it so that if any of the same values are too close (say, within 50 of another “x”) it adds a fixed amount to one of the values so that they are no longer that near to each other.

For example. If objArray[0].a = 50 and objArray[1].a = 100, it would add 100 to the ‘a’ value of objArray[1]. However, if an ‘a’ value is similar to a ‘b’ or ‘c’ value that’s not a problem - and likewise a ‘b’ value can be similar to an ‘a’ or ‘c’ value, but not similar to other ‘b’ values.

Anyone? I bumped the last thread 3 times and got nada. I know one of you out there has a good solution.