Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (def throws 10)
- (def hits 0.0)
- ;(dorun (for [i (range 0 5)](
- (def x (rand))
- (def y (rand))
- (def Rsquared (+ (* (- 0.5 x) (- 0.5 x)) (* (- 0.5 y) (- 0.5 y)) ) )
- (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