Crate prob [] [src]

Convinience types for calculating probabilities of independent events.

This crate provides a simple type which represents a probability of an isolated event happening.

It intergrates nicely with the Rust syntax by overloading various operations.


use prob::Probability;

let p1 = Probability(0.5);
let p2 = Probability(0.5);

let Probability(and) = p1 & p2;
let Probability(or)  = p1 | p2;
let Probability(xor) = p1 ^ p2;

assert_eq!(or,  0.75);
assert_eq!(and, 0.25);
assert_eq!(xor, 0.5);



An independent probability.