//! The exponential distribution.
+use core::fmt;
+
#[cfg(not(test))] // only necessary for no_std
use FloatMath;
}
}
+impl fmt::Debug for Exp1 {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.debug_tuple("Exp1")
+ .field(&self.0)
+ .finish()
+ }
+}
+
/// The exponential distribution `Exp(lambda)`.
///
/// This distribution has density function: `f(x) = lambda *
self.ind_sample(rng)
}
}
+
impl IndependentSample<f64> for Exp {
fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
let Exp1(n) = rng.gen::<Exp1>();
}
}
+impl fmt::Debug for Exp {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.debug_struct("Exp")
+ .field("lambda_inverse", &self.lambda_inverse)
+ .finish()
+ }
+}
+
#[cfg(test)]
mod tests {
use distributions::{IndependentSample, Sample};