Skip to content

Instantly share code, notes, and snippets.

@klahrich
Created April 10, 2020 17:28
Show Gist options
  • Save klahrich/0868dbea18f8ec7d861b0c405ca379b3 to your computer and use it in GitHub Desktop.
Save klahrich/0868dbea18f8ec7d861b0c405ca379b3 to your computer and use it in GitHub Desktop.
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