Skip to content

Commit 18ab777

Browse files
committed
ndarray-rand: Migrate to ShapeBuilder
1 parent 140bd12 commit 18ab777

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

ndarray-rand/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use ndarray::{
2121
Dimension,
2222
DataOwned,
2323
};
24-
use ndarray::IntoShape;
24+
use ndarray::ShapeBuilder;
2525

2626
/// Constructors for n-dimensional arrays with random elements.
2727
///
@@ -56,7 +56,7 @@ pub trait RandomExt<S, D>
5656
/// # }
5757
fn random<Sh, IdS>(shape: Sh, distribution: IdS) -> ArrayBase<S, D>
5858
where IdS: IndependentSample<S::Elem>,
59-
Sh: IntoShape<Dim=D>;
59+
Sh: ShapeBuilder<Dim=D>;
6060

6161
/// Create an array with shape `dim` with elements drawn from
6262
/// `distribution`, using a specific Rng `rng`.
@@ -65,7 +65,7 @@ pub trait RandomExt<S, D>
6565
fn random_using<Sh, IdS, R>(shape: Sh, distribution: IdS, rng: &mut R) -> ArrayBase<S, D>
6666
where IdS: IndependentSample<S::Elem>,
6767
R: Rng,
68-
Sh: IntoShape<Dim=D>;
68+
Sh: ShapeBuilder<Dim=D>;
6969
}
7070

7171
impl<S, D> RandomExt<S, D> for ArrayBase<S, D>
@@ -74,15 +74,15 @@ impl<S, D> RandomExt<S, D> for ArrayBase<S, D>
7474
{
7575
fn random<Sh, IdS>(shape: Sh, dist: IdS) -> ArrayBase<S, D>
7676
where IdS: IndependentSample<S::Elem>,
77-
Sh: IntoShape<Dim=D>,
77+
Sh: ShapeBuilder<Dim=D>,
7878
{
7979
Self::random_using(shape, dist, &mut rand::weak_rng())
8080
}
8181

8282
fn random_using<Sh, IdS, R>(shape: Sh, dist: IdS, rng: &mut R) -> ArrayBase<S, D>
8383
where IdS: IndependentSample<S::Elem>,
8484
R: Rng,
85-
Sh: IntoShape<Dim=D>,
85+
Sh: ShapeBuilder<Dim=D>,
8686
{
8787
let shape = shape.into_shape();
8888
let elements = Vec::from_iter((0..shape.size()).map(move |_| dist.ind_sample(rng)));

0 commit comments

Comments
 (0)