Skip to content

Commit 808fbab

Browse files
committed
Switch to using rand::gen_range for sample_weight
1 parent 56eaecb commit 808fbab

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/urn_random.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
use crate::types::{Index, Tree, Tree::*, Urn, Weight};
44
use crate::urn_deterministic::*;
5-
use rand::distributions::Uniform;
65
use rand::prelude::*;
76

87
/// Produces a value uniformly at random from the range `[0, w]`
98
fn sample_weight(w: Weight) -> Weight {
109
let mut rng = thread_rng();
11-
rng.sample(Uniform::new_inclusive(0, w))
10+
rng.gen_range(0..=w)
1211
}
1312

1413
fn sampler<F, T>(f: F, urn: Urn<T>) -> T

0 commit comments

Comments
 (0)