Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- a = 0.5
- b = 0.75
- nl = [1,10,100,1000,10000,100000]
- N, n = 1000000, 0
- def ex(N):
- n = 0
- for i in range(N):
- x = np.random.uniform(0,1)
- if x>a and x<b:
- n+=1
- return n/N
- n2 = [ex(i) for i in nl]
- plt.plot(nl,n2)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement