fn gen_random_array<I>(&self, shape: &[usize], dist: I) -> NdArray<T>
        where
            I: Distribution<f64>,
        {
            let size: usize = shape.iter().cloned().product();
            let mut rng = self.rng.borrow_mut();
            unsafe {
                let mut buf = Vec::with_capacity(size);
                for i in 0..size {
                    *buf.get_unchecked_mut(i) = T::from(dist.sample(&mut *rng)).unwrap();
                }
                buf.set_len(size);
                NdArray::from_shape_vec_unchecked(shape, buf)
            }
        }
/// Generates `ndarray::Array<T, ndarray::IxDyn>` whose elements are random numbers.
Generates `ndarray::Array` whose elements are random numbers.
Generates ` ndarray :: Array ` whose elements are random numbers .
fn gen_random_array<I>(&self, shape: &[usize], dist: I) -> NdArray<T>
        where
            I: Distribution<f64>,
        {
            let size: usize = shape.iter().cloned().product();
            let mut rng = self.rng.borrow_mut();
            unsafe {
                let mut buf = Vec::with_capacity(size);
                for i in 0..size {
                    *buf.get_unchecked_mut(i) = T::from(dist.sample(&mut *rng)).unwrap();
                }
                buf.set_len(size);
                NdArray::from_shape_vec_unchecked(shape, buf)
            }
        }
fn gen_random_array < I > ( & self , shape : & [ usize ] , dist : I ) -> NdArray < T > where I : Distribution < f64 > , { let size : usize = shape . iter ( ) . cloned ( ) . product ( ) ; let mut rng = self . rng . borrow_mut ( ) ; unsafe { let mut buf = Vec :: with_capacity ( size ) ; for i in 0 .. size { * buf . get_unchecked_mut ( i ) = T :: from ( dist . sample ( & mut * rng ) ) . unwrap ( ) ; } buf . set_len ( size ) ; NdArray :: from_shape_vec_unchecked ( shape , buf ) } }
Generates `ndarray::Array<T, ndarray::IxDyn>` whose elements are random numbers.
Generates ` ndarray :: Array<T ndarray :: IxDyn > ` whose elements are random numbers .
&self
shape
&[usize]
dist
I
&self
shape
&[usize]
dist
I