Crate stochasta

Crate stochasta 

Source
Expand description

Stochasta aims to be a simple stochastic analysis library.

§Example

use stochasta::CardDeck;
use stochasta::Probability;

let coin = CardDeck::from(vec!["heads", "tails"]);

assert_eq!(coin.size(), 2);
assert_eq!(coin.probability(&"heads"), Probability::new(1, 2));
assert_eq!(coin.probability(&"tails"), Probability::new(1, 2));

More examples may be found under the examples directory.

Modules§

playing_cards
Optional module for providing standard playing cards.

Structs§

CardDeck
A deck of cards.
CardDrawSequence
A representation of a sequence of drawn cards.
CardDrawTree
A representation of a card drawing process.
Probability
A probability is a rational number (ℚ) in the range of 0 and 1 (both inclusive).

Enums§

ProbabilityRatioError
Errors that may happen when trying to create a probability.

Constants§

PROBABILITY_ONE
A probability of 100%.
PROBABILITY_ZERO
A probability of 0%.