-
Ensuring two ‘random’ expressions do not produce same value
I have a Beam that I want to go from one randomly selected Blob to another.
So I select a random Blob for the “Start Point” of the Beam:
blobs = thisComp.layer("2").content("Blobs");
numBlobs = blobs.numProperties;
myBlob = Math.ceil(random(numBlobs));anchorPoint+blobs.content(myBlob).transform.position;
So far, so good. Plug the same expression into the “End Point” of the beam, and there’s a chance that the Beam will pick the same Blob as both its start and end point, which we don’t want.
I thought I’d be clever and put this into the “End Point”:
blobs = thisComp.layer("2").content("Blobs");
numBlobs = blobs.numProperties;
myBlob = Math.ceil(random(numBlobs));start = thisLayer("Effects")("Beam")("Starting Point");
do{
end = anchorPoint+blobs.content(myBlob).transform.position;
}while(start == end);
endBut this doesn’t seem to have any effect. Any ideas?