diff --git a/Cargo.toml b/Cargo.toml index 5b269a2..94bcd11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rand_distr" -version = "0.5.1" +version = "0.6.0-rc.0" authors = ["The Rand Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -33,7 +33,7 @@ std_math = ["num-traits/std"] serde = ["dep:serde", "dep:serde_with", "rand/serde"] [dependencies] -rand = { version = "0.9.0", default-features = false } +rand = { version = "0.10.0-rc.0", default-features = false } num-traits = { version = "0.2", default-features = false, features = ["libm"] } serde = { version = "1.0.103", features = ["derive"], optional = true } serde_with = { version = "3", optional = true } @@ -41,7 +41,7 @@ serde_with = { version = "3", optional = true } [dev-dependencies] rand_pcg = { version = "0.9.0" } # For inline examples -rand = { version = "0.9.0", features = ["small_rng"] } +rand = { version = "0.10.0-rc.0", features = ["small_rng"] } # Histogram implementation for testing uniformity average = { version = "0.16", features = [ "std" ] } # Special functions for testing distributions diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 90c8c39..dee9c49 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] [dev-dependencies] -rand = { version = "0.9.0", features = ["small_rng", "nightly"] } +rand = { version = "0.10.0-rc.0", features = ["small_rng", "nightly"] } rand_pcg = "0.9.0" rand_distr = { path = ".." } criterion = "0.5" diff --git a/distr_test/Cargo.toml b/distr_test/Cargo.toml index a296e61..23d2702 100644 --- a/distr_test/Cargo.toml +++ b/distr_test/Cargo.toml @@ -5,8 +5,8 @@ edition = "2024" publish = false [dev-dependencies] -rand_distr = { path = "..", version = "0.5.1", default-features = false, features = ["alloc"] } -rand = { version = "0.9.0", features = ["small_rng"] } +rand_distr = { path = "..", default-features = false, features = ["alloc"] } +rand = { version = "0.10.0-rc.0", features = ["small_rng"] } num-traits = "0.2.19" # Special functions for testing distributions special = "0.11.0" diff --git a/distr_test/tests/weighted.rs b/distr_test/tests/weighted.rs index 861e002..ecc3d65 100644 --- a/distr_test/tests/weighted.rs +++ b/distr_test/tests/weighted.rs @@ -96,11 +96,11 @@ fn choose_weighted_indexed() { } #[test] -fn choose_one_weighted_indexed() { +fn sample_one_weighted_indexed() { struct Adapter f64>(Vec, F); impl f64> Distribution for Adapter { fn sample(&self, rng: &mut R) -> i64 { - *IndexedRandom::choose_multiple_weighted(&self.0[..], rng, 1, |i| (self.1)(*i)) + *IndexedRandom::sample_weighted(&self.0[..], rng, 1, |i| (self.1)(*i)) .unwrap() .next() .unwrap() @@ -120,13 +120,12 @@ fn choose_one_weighted_indexed() { } #[test] -fn choose_two_weighted_indexed() { +fn sample_two_weighted_indexed() { struct Adapter f64>(Vec, F); impl f64> Distribution for Adapter { fn sample(&self, rng: &mut R) -> i64 { let mut iter = - IndexedRandom::choose_multiple_weighted(&self.0[..], rng, 2, |i| (self.1)(*i)) - .unwrap(); + IndexedRandom::sample_weighted(&self.0[..], rng, 2, |i| (self.1)(*i)).unwrap(); let mut a = *iter.next().unwrap(); let mut b = *iter.next().unwrap(); assert!(iter.next().is_none()); @@ -204,12 +203,12 @@ fn choose_stable_iterator() { } #[test] -fn choose_two_iterator() { +fn sample_two_iterator() { struct Adapter(I); impl> Distribution for Adapter { fn sample(&self, rng: &mut R) -> i64 { let mut buf = [0; 2]; - IteratorRandom::choose_multiple_fill(self.0.clone(), rng, &mut buf); + IteratorRandom::sample_fill(self.0.clone(), rng, &mut buf); buf.sort_unstable(); assert!(buf[0] < 99 && buf[1] >= 1); let a = buf[0];