We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cb8f6e2 + e723fe0 commit 2a514a0Copy full SHA for 2a514a0
src/librand/lib.rs
@@ -243,7 +243,7 @@ pub trait Rng : Sized {
243
/// println!("{}", rng.gen_weighted_bool(3));
244
/// ```
245
fn gen_weighted_bool(&mut self, n: uint) -> bool {
246
- n == 0 || self.gen_range(0, n) == 0
+ n <= 1 || self.gen_range(0, n) == 0
247
}
248
249
/// Return an iterator of random characters from the set A-Z,a-z,0-9.
0 commit comments