use mod_rand::tier1::Xoshiro256;
fn main() {
let seed = 0x2026_0511_C0DE_F00D;
let n: u64 = 10_000_000;
let mut rng = Xoshiro256::seed_from_u64(seed);
let mut inside = 0u64;
for _ in 0..n {
let x = rng.next_f64();
let y = rng.next_f64();
if x * x + y * y <= 1.0 {
inside += 1;
}
}
let pi_estimate = 4.0 * inside as f64 / n as f64;
println!("seed = {seed:#018x}");
println!("samples = {n}");
println!("pi est. = {pi_estimate:.6}");
println!("error = {:+.6}", pi_estimate - std::f64::consts::PI);
println!();
println!("Reproducibility: rerun this example and you'll get the");
println!("same pi estimate to the last digit.");
}