-
-
Notifications
You must be signed in to change notification settings - Fork 489
Closed as not planned
Labels
X-bugType: bug reportType: bug report
Description
Summary
It seems that random_range() always returns its lower bound. I've checked it with debugger, and it seems that value returned from Rng is for unknown reason replaced with 0, and then forced into range.
Rand 0.9.0, Rust 1.84.1, Windows 11.
Code sample
#[test]
fn gen() {
let mut rng = StepRng::new(1, 1);
let res = [
rng.random_range(1..=6),
rng.random_range(1..=6),
rng.random_range(1..=6),
];
assert_eq!(res, [1, 2, 3]);
}results in
assertion `left == right` failed
left: [1, 1, 1]
right: [1, 2, 3]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
X-bugType: bug reportType: bug report