psect_core/
distribution.rs1use std::fmt::Debug;
2
3pub trait Distribution<Outcome>: Debug {
4 fn p(&self, outcome: Outcome) -> f64;
5}
6
7#[derive(Debug)]
8pub struct Bernoulli {
9 pub prior: f64,
10}
11
12impl Distribution<bool> for Bernoulli {
13 fn p(&self, outcome: bool) -> f64 {
14 match outcome {
15 true => self.prior,
16 false => 1.0 - self.prior,
17 }
18 }
19}
20
21#[derive(Debug)]
22pub struct TestOutcomeDistributions<T> {
23 pub old: Box<dyn Distribution<T>>,
24 pub new: Box<dyn Distribution<T>>,
25}