We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fa9809 commit 3888d88Copy full SHA for 3888d88
rand_distr/src/pert.rs
@@ -97,13 +97,8 @@ where
97
}
98
99
let range = max - min;
100
- let mu = (min + max + shape * mode) / (shape + F::from(2.).unwrap());
101
- let v = if mu == mode {
102
- shape * F::from(0.5).unwrap() + F::from(1.).unwrap()
103
- } else {
104
- (mu - min) * (F::from(2.).unwrap() * mode - min - max) / ((mode - mu) * (max - min))
105
- };
106
- let w = v * (max - mu) / (mu - min);
+ let v = F::from(1.0).unwrap() + shape * (mode - min) / range;
+ let w = F::from(1.0).unwrap() + shape * (max - mode) / range;
107
let beta = Beta::new(v, w).map_err(|_| PertError::RangeTooSmall)?;
108
Ok(Pert { min, range, beta })
109
0 commit comments