We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents adc2b10 + baeec7b commit c04ae0fCopy full SHA for c04ae0f
src/librand/distributions/gamma.rs
@@ -103,12 +103,14 @@ impl Gamma {
103
assert!(shape > 0.0, "Gamma::new called with shape <= 0");
104
assert!(scale > 0.0, "Gamma::new called with scale <= 0");
105
106
- let repr = match shape {
107
- 1.0 => One(Exp::new(1.0 / scale)),
108
- 0.0...1.0 => Small(GammaSmallShape::new_raw(shape, scale)),
109
- _ => Large(GammaLargeShape::new_raw(shape, scale)),
+ let repr = if shape == 1.0 {
+ One(Exp::new(1.0 / scale))
+ } else if 0.0 <= shape && shape < 1.0 {
+ Small(GammaSmallShape::new_raw(shape, scale))
110
+ } else {
111
+ Large(GammaLargeShape::new_raw(shape, scale))
112
};
- Gamma { repr: repr }
113
+ Gamma { repr }
114
}
115
116
0 commit comments