samedi 29 septembre 2018

Generating 8 couples of integers

I want to have 8 couples of integers such that they all have different coordinates and they are all within 5 units of each other (using the euclidean distance).

To clarify, I want to have

(x1, y1)

(x2, y2)

(x3, y3)

(x4, y4)

(x5, y5)

(x6, y6)

(x7, y7)

(x8, y8)

where the xi's and yi's are randomly generated integers (via nextInt) so that there are no indexes i, j such that xi = xj and yi = yj and such that for all indexes i, j sqrt( (xi - xj)^2 + (yi - yj)^2 ) <= 5.




Aucun commentaire:

Enregistrer un commentaire