Create random circles in a grid

Big thanks for the explanation.

I have followed your explanation and used what you told.

But how do I know the location of the red circles with this way of creating them?
Because everytime when my diver steps on the red circle they lose a health.
Should it be something like

If (xdiverlocation == ??? && ydiverlocation == ??? ) {
   life -= 1;
}

I don’t know how to find the location of the red circles that should be in the ???.