Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monte carlo crystal #893

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

henrikac
Copy link
Contributor

This PR adds the Monte Carlo methods in Crystal.

@henrikac
Copy link
Contributor Author

[lang: crystal]

@Amaras Amaras added Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) hacktoberfest-accepted labels Oct 21, 2021
@Andriamanitra
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) lang: crystal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants