Skip to content

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

@thomasalcock

Description

@thomasalcock

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()));

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions