Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -33,15 +33,15 @@ 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 }

[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
Expand Down
2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions distr_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 6 additions & 7 deletions distr_test/tests/weighted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ fn choose_weighted_indexed() {
}

#[test]
fn choose_one_weighted_indexed() {
fn sample_one_weighted_indexed() {
struct Adapter<F: Fn(i64) -> f64>(Vec<i64>, F);
impl<F: Fn(i64) -> f64> Distribution<i64> for Adapter<F> {
fn sample<R: rand::Rng + ?Sized>(&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()
Expand All @@ -120,13 +120,12 @@ fn choose_one_weighted_indexed() {
}

#[test]
fn choose_two_weighted_indexed() {
fn sample_two_weighted_indexed() {
struct Adapter<F: Fn(i64) -> f64>(Vec<i64>, F);
impl<F: Fn(i64) -> f64> Distribution<i64> for Adapter<F> {
fn sample<R: rand::Rng + ?Sized>(&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());
Expand Down Expand Up @@ -204,12 +203,12 @@ fn choose_stable_iterator() {
}

#[test]
fn choose_two_iterator() {
fn sample_two_iterator() {
struct Adapter<I>(I);
impl<I: Clone + Iterator<Item = i64>> Distribution<i64> for Adapter<I> {
fn sample<R: rand::Rng + ?Sized>(&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];
Expand Down
Loading