Skip to content

Commit 5090c6b

Browse files
committed
And the quickcheck example
1 parent baf2295 commit 5090c6b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ndarray-rand/tests/tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use ndarray::{Array, Array2, ArrayView1, Axis};
22
#[cfg(feature = "quickcheck")]
3-
use ndarray_rand::rand::{distributions::Distribution, thread_rng};
3+
use ndarray_rand::rand::{distr::Distribution, rng};
44

55
use ndarray::ShapeBuilder;
66
use ndarray_rand::rand_distr::Uniform;
@@ -90,12 +90,12 @@ quickcheck! {
9090
#[cfg_attr(miri, ignore)] // This takes *forever* with Miri
9191
fn sampling_behaves_as_expected(m: u8, n: u8, strategy: SamplingStrategy) -> TestResult {
9292
let (m, n) = (m as usize, n as usize);
93-
let a = Array::random((m, n), Uniform::new(0., 2.));
94-
let mut rng = &mut thread_rng();
93+
let a = Array::random((m, n), Uniform::new(0., 2.).unwrap());
94+
let mut rng = &mut rng();
9595

9696
// We don't want to deal with sampling from 0-length axes in this test
9797
if m != 0 {
98-
let n_row_samples = Uniform::from(1..m+1).sample(&mut rng);
98+
let n_row_samples = Uniform::new(1, m+1).unwrap().sample(&mut rng);
9999
if !sampling_works(&a, strategy.clone(), Axis(0), n_row_samples) {
100100
return TestResult::failed();
101101
}
@@ -105,7 +105,7 @@ quickcheck! {
105105

106106
// We don't want to deal with sampling from 0-length axes in this test
107107
if n != 0 {
108-
let n_col_samples = Uniform::from(1..n+1).sample(&mut rng);
108+
let n_col_samples = Uniform::new(1, n+1).unwrap().sample(&mut rng);
109109
if !sampling_works(&a, strategy, Axis(1), n_col_samples) {
110110
return TestResult::failed();
111111
}

0 commit comments

Comments
 (0)