pub struct Exponential { /* private fields */ }Expand description
A continuous distribution often used to model waiting times between events.
Characterized by the memoryless property.
Mathematical Properties:
- Support: [0, +∞)
- PDF: f(x) = λ × exp(-λx) for x ≥ 0
- Mean: 1 / λ
- Variance: 1 / λ²
- Memoryless: P(X > s + t | X > s) = P(X > t)
Example:
// Average wait time of 2 minutes (rate = 0.5 per minute)
let wait_time = sample(addr!("wait"), Exponential::new(0.5).unwrap());
// Service time model
let service = sample(addr!("service_time"), Exponential::new(1.5).unwrap())
.bind(|time| {
if time > 5.0 {
pure("slow")
} else {
pure("fast")
}
});
// Observe actual waiting time
let observed = observe(addr!("actual_wait"), Exponential::new(0.3).unwrap(), 4.2);Implementations§
Source§impl Exponential
impl Exponential
Trait Implementations§
Source§impl Clone for Exponential
impl Clone for Exponential
Source§fn clone(&self) -> Exponential
fn clone(&self) -> Exponential
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Exponential
impl Debug for Exponential
Source§impl Distribution<f64> for Exponential
impl Distribution<f64> for Exponential
Source§fn sample(&self, rng: &mut dyn RngCore) -> f64
fn sample(&self, rng: &mut dyn RngCore) -> f64
Generate a random sample (with its natural type),
T, from the distribution, using the provided random number generator, rng. Read moreSource§impl Validate for Exponential
impl Validate for Exponential
fn validate(&self) -> FugueResult<()>
impl Copy for Exponential
Auto Trait Implementations§
impl Freeze for Exponential
impl RefUnwindSafe for Exponential
impl Send for Exponential
impl Sync for Exponential
impl Unpin for Exponential
impl UnwindSafe for Exponential
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more