Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poisson distribution returns -1.0 for very small values of lambda #1428

Closed
thomasalcock opened this issue Apr 2, 2024 · 2 comments
Closed

Comments

@thomasalcock
Copy link

thomasalcock commented Apr 2, 2024

With rand_distr = "0.4.3" and rand = "0.8.5" I was able to sample -1.0 by providing small enough values of lambda.

use rand_distr::{Distribution,Poisson};
use rand::thread_rng;

fn main() {

    let poisson_dist: Poisson<f32> = Poisson::new(0.0000000002).unwrap();
    println!("{:?}", poisson_dist.sample(&mut thread_rng()));

    let poisson_dist: Poisson<f64> = Poisson::new(0.0000000000000000002).unwrap();
    println!("{:?}", poisson_dist.sample(&mut thread_rng()));

}
@dhardy
Copy link
Member

dhardy commented Apr 10, 2024

I can reproduce the bug with the versions listed, but not with the latest alpha releases.

@dhardy dhardy closed this as completed Apr 10, 2024
@vks
Copy link
Collaborator

vks commented Apr 11, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants