mercredi 20 mars 2019

How to calculate a random place on a circle using Java

I am making two circles using Java, one on the other, so it looks like this:

Click for picture of circles

I would like to generate a rectangle randomly on the circle, in a way that it would go on the brown part of the circle, but not on the white circle. I think it may require a bit or trigonometry. Can someone provide sample code that would allow me to do this?

Thanks




Aucun commentaire:

Enregistrer un commentaire