algorithm-archive icon indicating copy to clipboard operation
algorithm-archive copied to clipboard

Monte carlo crystal

Open henrikac opened this issue 4 years ago • 2 comments

This PR adds the Monte Carlo methods in Crystal.

henrikac avatar Oct 21 '21 16:10 henrikac

[lang: crystal]

henrikac avatar Oct 21 '21 16:10 henrikac

Perhaps more idiomatic way to count points inside the circle would be

pi_count = n.times.count do
  in_circle(rand, rand)
end

but other than that the code looks good to me.

Andriamanitra avatar Apr 07 '22 14:04 Andriamanitra