I have read an image in and I want to randomly set values for int x and int y but only up to the width and height of the image respectively and not below 0,0 so that they do not exceed the boundaries of the image.
Something like this:
read image //I have this already
assign random value to int x up to maxWidth of image but >= 0
assign random value to int y up to maxHeight of image but >= 0
end
Typically, almost all of the images that I am working with are approximately 424 x 424.
I am ultimately looking to end up with values such as:
int x = 325;
int y = 10;
or
int x = 424
int y = 351
or
int x = 109
int y = 230
Each time I run the code, the values for x and y will be reassigned randomly as before.
Is this possible?
You want something like: