File tree 1 file changed +2
-8
lines changed
1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 10
10
11
11
#[ cfg( feature = "alloc" ) ]
12
12
use alloc:: string:: String ;
13
+ use core:: array;
13
14
use core:: char;
14
15
use core:: num:: Wrapping ;
15
16
@@ -18,7 +19,6 @@ use crate::distr::SampleString;
18
19
use crate :: distr:: { Distribution , StandardUniform , Uniform } ;
19
20
use crate :: Rng ;
20
21
21
- use core:: mem:: { self , MaybeUninit } ;
22
22
#[ cfg( feature = "simd_support" ) ]
23
23
use core:: simd:: prelude:: * ;
24
24
#[ cfg( feature = "simd_support" ) ]
@@ -238,13 +238,7 @@ where
238
238
{
239
239
#[ inline]
240
240
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 ( ) )
248
242
}
249
243
}
250
244
You can’t perform that action at this time.
0 commit comments