I have to write a code where I write a random number, it should give me the number of random points with coordinates and after these points to draw the corresponding circle. I really need help because I do not even know how to start writting.
I find this code on Stackoverflow:
import random
import math
# radius of the circle
circle_r = 10
# center of the circle (x, y)
circle_x = 5
circle_y = 7
# random angle
alpha = 2 * math.pi * random.random()
# random radius
r = circle_r * math.sqrt(random.random())
# calculating coordinates
x = r * math.cos(alpha) + circle_x
y = r * math.sin(alpha) + circle_y
print("Random point", (x, y))
How can I change this code that I could get random multiple points for random circle?
Aucun commentaire:
Enregistrer un commentaire