monte-carlo-pi

command module
v0.0.0-...-4248e6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 10 Imported by: 0

README

monte-carlo-pi

A monte carlo simulation written in go that attempts to estimate Pi. Inspired by this excellent blog post. I'm using Ebitengine to show the algorithm work visually. When you go run main.go you will see something like this:

./.github/demo.gif

As you can see, this run achieved a result of 3.140872, which is off by only 0.000721. Due to the nature of monte carlo simulations, different runs will give you different results but I was consistently estimating Pi pretty accurately. Play with the constants at the top (make sure to keep width/height proportionate if you change them) and try running the test again.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL