Created
April 10, 2020 17:28
-
-
Save klahrich/0868dbea18f8ec7d861b0c405ca379b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math as m | |
def is_inside(): | |
x2 = r.random()**2 | |
y2 = r.random()**2 | |
# Increment if inside unit circle. | |
if m.sqrt(x2 + y2) < 1.0: | |
return 1 | |
else: | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment