Skip to content

toziegler/poisson_scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PoissonScheduler

PoissonScheduler provides a mechanism to execute a given function/closure at timestamps determined by a Poisson process. This is particularly useful in simulation and testing scenarios where events or requests need to be generated at a rate that follows the Poisson distribution.

The Poisson process is a stochastic model that describes events that occur independently and at a fixed average rate. It's a popular model in various fields, including computer science, telecommunications, and finance.

Learn more about the importance and applications of this approach from this article.

Examples

use poisson_scheduler::PoissonScheduler;
use std::time::Instant;
use std::time::Duration;

let rate = 100.0; // 100 events per second
let mut scheduler = PoissonScheduler::new(rate);

scheduler.run(Duration::new(1,0), |timestamp| {
    println!("Event scheduled at {:?}", timestamp);
});

About

Poission scheduler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages