Machine Learning, Data Science, Markov Chains, Monte Carlo.
random.uniform(0, 360) # generate a random angle x_new = x + delta * math.cos(theta) y_new = y + delta * math.sin(theta) # do not move if new point is out of square if -1 < x_new < 1 and -1 < y_new < 1: (x, y) = (x_new, y_new) if x**2 + y**2 < 1: # in the circle points_in += 1 print(4*points_in/N)