| Crates.io | ruststat |
| lib.rs | ruststat |
| version | 0.1.5 |
| created_at | 2025-09-04 16:53:16.846987+00 |
| updated_at | 2025-09-05 17:05:32.837827+00 |
| description | Utilities for working with many common random variables --- probability mass function (pmf), probability density function (pdf), cumulative distribution function (cdf), percentiles (inverse cdf), random number generation |
| homepage | |
| repository | https://github.com/mabognar/ruststat |
| max_upload_size | |
| id | 1824510 |
| size | 137,177 |
Add this to your Cargo.toml:
[dependencies]
ruststat = "0.1.5" # Replace with the latest version
use ruststat::*;
// X~N(mu=0,sigma=1.0), find 97.5th percentile
println!("normal percentile: {}", normal_per(0.975, 0.0, 1.0));
// X~Bin(n=10,p=0.7), compute P(X=4)
println!("binomial probability: {}", bin_pmf(4, 10, 0.7));
For convenience, functions can also be accessed via Structs.
use ruststat::*;
// X~Beta(alpha=0.5,beta=2.0)
let mut mybeta = BetaDist{alpha:0.5, beta:2.0};
// 30th percentile
println!("percentile: {}", mybeta.per(0.3));
// P(X <= 0.4)
println!("cdf: {}", mybeta.cdf(0.4));
// Random draw
println!("random draw: {}", mybeta.ran());
// Variance
println!("variance: {}", mybeta.var());