Skip to content

Commit 95865cf

Browse files
committed
Deprecate Rng::gen_weighted_bool
1 parent f03bf15 commit 95865cf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ pub trait Rng: RngCore {
521521
/// # Example
522522
///
523523
/// ```rust
524+
/// #[allow(deprecated)]
524525
/// use rand::{thread_rng, Rng};
525526
///
526527
/// let mut rng = thread_rng();
@@ -532,6 +533,7 @@ pub trait Rng: RngCore {
532533
/// // First meaningful use of `gen_weighted_bool`.
533534
/// println!("{}", rng.gen_weighted_bool(3));
534535
/// ```
536+
#[deprecated(since="0.5.0", note="use gen_bool instead")]
535537
fn gen_weighted_bool(&mut self, n: u32) -> bool {
536538
// Short-circuit after `n <= 1` to avoid panic in `gen_range`
537539
n <= 1 || self.gen_range(0, n) == 0
@@ -1091,6 +1093,7 @@ mod test {
10911093
}
10921094

10931095
#[test]
1096+
#[allow(deprecated)]
10941097
fn test_gen_weighted_bool() {
10951098
let mut r = rng(104);
10961099
assert_eq!(r.gen_weighted_bool(0), true);

0 commit comments

Comments
 (0)