feat: Initial commit
This commit is contained in:
14
pymontecarlo.py
Normal file
14
pymontecarlo.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from random import random
|
||||
|
||||
n = 100000000
|
||||
|
||||
din = 0
|
||||
|
||||
for i in range(n):
|
||||
x = random()
|
||||
y = random()
|
||||
|
||||
if x**2 + y**2 <= 1:
|
||||
din += 1
|
||||
|
||||
print((din / n)*4)
|
||||
Reference in New Issue
Block a user