### 2 releases

Uses old Rust 2015

0.1.1 | Nov 6, 2016 |
---|---|

0.1.0 | Nov 6, 2016 |

#**5** in #probabilities

**MIT**license

7KB

88 lines

# Prob: Calculating independent probabilities

Just a mini library for handling independent probabilities.

###
`lib.rs`

:

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.

# Example

`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``)``;`

#### Dependencies

~240KB