Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- repetition = 3000
- radius = 10
- x1 = []
- y1 = []
- for i in range(repetition):
- x = np.random.uniform(-radius, radius)
- y = np.random.uniform(-radius, radius)
- if (x**2 + y**2 < radius**2):
- x1.append(x)
- y1.append(y)
- fig = plt.figure()
- ax = fig.add_subplot(111)
- ax.set_xlim([-radius, radius])
- ax.set_ylim([-radius, radius])
- ax.scatter(x1, y1, color = 'magenta')
- # circle1 = plt.Circle((0, 0), radius, color = 'b', fill=False)
- # ax.add_artist(circle1)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement