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

Panic when samping range f32::MIN..=f32::MAX #1400

Closed
aljazerzen opened this issue Feb 20, 2024 · 1 comment
Closed

Panic when samping range f32::MIN..=f32::MAX #1400

aljazerzen opened this issue Feb 20, 2024 · 1 comment

Comments

@aljazerzen
Copy link

Reproduction:

use rand::Rng;

fn main() {
    let mut rand = rand::thread_rng();

    println!("{}", rand.gen_range(f32::MIN..=f32::MAX));
}
thread 'main' panicked at .cargo/registry/src/index.crates.io-6f17d22bba15001f/rand-0.8.5/src/distributions/uniform.rs:998:1:
Uniform::new_inclusive: range overflow

rand version: 0.8.5

@dhardy
Copy link
Member

dhardy commented Feb 21, 2024

This is the expected behaviour: #1090, #1351

@dhardy dhardy closed this as completed Feb 21, 2024
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

2 participants