Skip to content

Commit fc1bace

Browse files
committed
Update ndarray-rand random function
1 parent 24f8d59 commit fc1bace

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

ndarray-rand/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ impl<S, D> RandomExt<S, D> for ArrayBase<S, D>
8686
R: Rng,
8787
Sh: ShapeBuilder<Dim=D>,
8888
{
89-
let shape = shape.into_shape();
90-
let elements = Vec::from_iter((0..shape.size()).map(move |_| dist.ind_sample(rng)));
91-
Self::from_shape_vec(shape, elements).unwrap()
89+
Self::from_shape_fn(shape, |_| dist.ind_sample(rng))
9290
}
9391
}
9492

0 commit comments

Comments
 (0)