We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I don't know if it has a function for this. Similar to constrain() but the opposite , the number cannot go there.
int xImg= int(random (0, 8))*int(-144); // grid X
int yImg=int(random (0, 6))*int(144); // grid y
int sImg =int(random(1, 5))*int(72); // icon size
so I don't want to have those combinations (xImg,yImg) (4,1) (5,1)(6,1)(7,1)(8,1)
if (yImg==1 && xImg>=4 && xImg<=8){
redo random until the number is not == to (yImg==1 && xImg>=4 && xImg<=8)
}
thanks
Answers
https://forum.Processing.org/two/discussions/tagged?Tag=do/while
so if i understand it wil be something like that
Just by taking a quick glance on your code above, it's pretty obvious it won't compile!
It's a
do...while
pair, not just 1 singledo
. Please make an effort to have a compilable code to post.you don't need a do while loop in this case - just calculate y first and use a different range for x if y is 1
NB (int)random(n) will return a random number from 0 to n-1