Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from matplotlib import pyplot as plt
- import numpy as np
- #3.14
- N=100000
- x1=[x for x in range(0,N,100)]
- x1.remove(x1[0])
- y1=[]
- a,b,x,y=0.5,0.75,0,1
- n=0
- for i in range (N):
- c=np.random.uniform(0,1)
- if c>a and c<b:
- n+=1
- if i in x1:
- y1.append(n/i)
- print(n/N)
- plt.plot(x1,y1)
- plt.title('PLOT')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement