Monte Carlo methods: Difference between revisions

No edit summary
Line 423:
 
=={{header|Crystal}}==
{{trans|Ruby}}
<lang ruby>def approx_pi(throws)
times_inside = throws.times.count {Math.hypot(rand, rand) <= 1.0}
Anonymous user