https://github.com/dfithian/rust-estimate-pi
Rust tutorial to estimate Pi
https://github.com/dfithian/rust-estimate-pi
Last synced: 2 months ago
JSON representation
Rust tutorial to estimate Pi
- Host: GitHub
- URL: https://github.com/dfithian/rust-estimate-pi
- Owner: dfithian
- Created: 2019-09-10T16:57:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-18T16:08:51.000Z (over 5 years ago)
- Last Synced: 2025-01-29T11:11:23.065Z (4 months ago)
- Language: Rust
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Estimating Pi with Rust
This project is an experiment helping me to learn Rust by estimating Pi.
# Modules
* `sample.rs` contains utilities for sampling random numbers within the unit circle.
* `simple.rs` contains a single-threaded estimation mechanic that sums up the average of the
coordinates from the sample that are in versus not-in the unit circle.
* `parallel.rs` contains a parallelized estimation mechanic of the function in `simple.rs`.
* `time.rs` contains utilities for timing and printing the different estimation mechanics.
* `arguments.rs` contains utilities for parsing command-line arguments.# Other features
* `lib.rs` re-exports modules.
* `simple/main.rs`, `parallel/main.rs` are entrypoints for the different functions with static
inputs.
* `arguments/main.rs` parses command-line arguments but otherwise does the same thing as
`parallel/main.rs`.
* `trait/main.rs` parses command-line arguments and mixes in a trait for timing but otherwise does
the same thing as `parallel/main.rs`.
* `Cargo.toml` shows how to use libraries with binaries and to define multiple binaries in a single
project.