Skip to content

Commit 983584f

Browse files
Rollup merge of #143710 - joshtriplett:random-updates, r=joshtriplett
Updates to random number generation APIs Updates based on discussions about random number generation. - Add comment on `RandomSource::fill_bytes` about multiple calls, to allow efficient implementations for random sources that generate a word at a time. - Drop the `Random` trait in favor of `Distribution<T>`, which will let people make calls like random(1..=6), and which allows for future expansion to non-uniform distributions, as well as floating-point. (For now, this is only implemented for `RangeFull`, to get the interface in place. Subsequent PRs will implement it for other range types.)
2 parents ccb879a + 131436d commit 983584f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/pass/shims/random.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![feature(random)]
22

33
fn main() {
4-
let _x: i32 = std::random::random();
4+
let _x: i32 = std::random::random(..);
55
}

0 commit comments

Comments
 (0)