| Crates.io | coin_flip |
| lib.rs | coin_flip |
| version | 0.1.1 |
| created_at | 2025-09-17 06:40:07.445007+00 |
| updated_at | 2025-09-17 06:46:02.69196+00 |
| description | A library for flipping a coin and getting the result. |
| homepage | https://github.com/OmniKobra/coin_flip_rust |
| repository | https://github.com/OmniKobra/coin_flip_rust |
| max_upload_size | |
| id | 1842834 |
| size | 11,480 |
A simple Rust program that simulates flipping a fair coin multiple times and reports the results with percentages.
Heads or Tails).Add rand to your Cargo.toml:
[dependencies]
rand = "0.9.2"
Clone the repository and run the program:
cargo run
Example output:
Out of 100:
Heads: 50 (50.00%)
Tails: 50 (50.00%)
src/
├── lib.rs # Library code (coin enum, flip logic, percentage calculation)
└── main.rs # Entry point, runs the simulation
flip_coin generates a random Heads or Tails.This project is open source and available under the MIT License.