Skip to content

Monte carlo crystal #893

New issue

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

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

Already on GitHub? # to your account

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.

# for free to join this conversation on GitHub. Already have an account? # 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.

3 participants