Monte Carlo methods: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: elided one too many hyphens.)
(→‎{{header|Elixir}}: change :random -> :rand module)
Line 398:
<lang elixir>defmodule MonteCarlo do
def pi(n) do
:random.seed(:os.timestamp)
count = Enum.count(1..n, fn _ ->
x = :randomrand.uniform
y = :randomrand.uniform
:math.sqrt(x*x + y*y) <= 1
end)