Monte Carlo methods: Difference between revisions

Content added Content deleted
(Added Quackery.)
(Added Arturo implementation)
Line 201: Line 201:
100 000 000:+3.14153276000000e +0
100 000 000:+3.14153276000000e +0
</pre>
</pre>

=={{header|Arturo}}==

<lang rebol>Pi: function [throws][
inside: new 0.0
do.times: throws [
if 1 > hypot random 0 1.0 random 0 1.0 -> inc 'inside
]
return 4 * inside / throws
]
loop [100 1000 10000 100000 1000000] 'n ->
print [pad to :string n 10 "=>" Pi n]</lang>

{{out}}

<pre> 100 => 3.4
1000 => 3.112
10000 => 3.1392
100000 => 3.14368
1000000 => 3.14106</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==