Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 915 Bytes

File metadata and controls

47 lines (33 loc) · 915 Bytes

Pi Estimation

Estimates the value of π using the Monte Carlo method.

Method

We generate random points within the unit square and count how many fall within a circle of radius 1 centered at the origin. The ratio of the number of points within the circle to the total number of points approaches π/4.

Illustration of a Monte Carlo simulation

Run Estimation

Build and run an estimation with the default configuration.

go build ./cmd/pi
./pi

Use the --help flag to see configuration options.

./pi --help

Development

  1. Run tests

    go test ./...
  2. Check formatting

    gofmt -d .
  3. Check linking

    go vet ./...
  4. Generate new diagram for the readme

    go run ./cmd/generatediagram