File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 1010
1111#[ cfg( feature = "alloc" ) ]
1212use alloc:: string:: String ;
13+ use core:: array;
1314use core:: char;
1415use core:: num:: Wrapping ;
1516
@@ -18,7 +19,6 @@ use crate::distr::SampleString;
1819use crate :: distr:: { Distribution , StandardUniform , Uniform } ;
1920use crate :: Rng ;
2021
21- use core:: mem:: { self , MaybeUninit } ;
2222#[ cfg( feature = "simd_support" ) ]
2323use core:: simd:: prelude:: * ;
2424#[ cfg( feature = "simd_support" ) ]
@@ -238,13 +238,7 @@ where
238238{
239239 #[ inline]
240240 fn sample < R : Rng + ?Sized > ( & self , _rng : & mut R ) -> [ T ; N ] {
241- let mut buff: [ MaybeUninit < T > ; N ] = unsafe { MaybeUninit :: uninit ( ) . assume_init ( ) } ;
242-
243- for elem in & mut buff {
244- * elem = MaybeUninit :: new ( _rng. random ( ) ) ;
245- }
246-
247- unsafe { mem:: transmute_copy :: < _ , _ > ( & buff) }
241+ array:: from_fn ( |_| _rng. random ( ) )
248242 }
249243}
250244
You can’t perform that action at this time.
0 commit comments