Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (def throws 10)
- (def hits 0.0)
- (defn r-squared [x y]
- (+ (* (- 0.5 x) (- 0.5 x))
- (* (- 0.5 y) (- 0.5 y))))
- ; end of defn
- (println Rsquared)
- (if (< Rsquared 0.25) (def hits (+ hits 1)))
- (def pi (* 4 (/ hits throws)) )
- (println pi)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement