Skip to content

Sampling a Gumbel returns NaN for every parameter pair #461

Description

@DRMacIver
use rand::SeedableRng;
use rand::distr::Distribution;
use statrs::distribution::Gumbel;

fn main() {
    let mut rng = rand::rngs::StdRng::seed_from_u64(42);
    let g = Gumbel::new(0.0, 1.0).unwrap();
    let samples: Vec<f64> = (0..5).map(|_| g.sample(&mut rng)).collect();
    println!("{samples:?}");
}

Output:

[NaN, NaN, NaN, NaN, NaN]

Every draw is NaN, for any location and scale and any RNG. Gumbel::new(0.0, 1.0) returns Ok, and the distribution's cdf, inverse_cdf and moments are all finite, so only sampling is affected.

Tested on statrs 0.19.1 and current main (rand feature).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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