File tree 2 files changed +7
-6
lines changed 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ mod mersenne;
17
17
#[ derive( Debug ) ]
18
18
enum PyRng {
19
19
Std ( rand:: rngs:: ThreadRng ) ,
20
- MT ( mersenne:: MT19937 ) ,
20
+ MT ( Box < mersenne:: MT19937 > ) ,
21
21
}
22
22
23
23
impl Default for PyRng {
@@ -89,7 +89,7 @@ impl PyRandom {
89
89
if cfg ! ( target_endian = "big" ) {
90
90
key. reverse ( ) ;
91
91
}
92
- PyRng :: MT ( mersenne:: MT19937 :: new_with_slice_seed ( & key) )
92
+ PyRng :: MT ( Box :: new ( mersenne:: MT19937 :: new_with_slice_seed ( & key) ) )
93
93
}
94
94
} ;
95
95
Original file line number Diff line number Diff line change
1
+ #![ allow( clippy:: unreadable_literal) ]
2
+
1
3
/*
2
4
A C-program for MT19937, with initialization improved 2002/1/26.
3
5
Coded by Takuji Nishimura and Makoto Matsumoto.
@@ -78,7 +80,7 @@ impl MT19937 {
78
80
79
81
/* initializes self.mt[N] with a seed */
80
82
fn seed ( & mut self , s : u32 ) {
81
- self . mt [ 0 ] = s & 0xffffffffu32 ;
83
+ self . mt [ 0 ] = s;
82
84
self . mti = 1 ;
83
85
while self . mti < N {
84
86
self . mt [ self . mti ] = 1812433253u32
@@ -88,8 +90,6 @@ impl MT19937 {
88
90
/* In the previous versions, MSBs of the seed affect */
89
91
/* only MSBs of the array self.mt[]. */
90
92
/* 2002/01/09 modified by Makoto Matsumoto */
91
- self . mt [ self . mti ] &= 0xffffffffu32 ;
92
- /* for >32 bit machines */
93
93
self . mti += 1 ;
94
94
}
95
95
}
@@ -205,6 +205,7 @@ impl rand::RngCore for MT19937 {
205
205
rand_core:: impls:: fill_bytes_via_next ( self , dest)
206
206
}
207
207
fn try_fill_bytes ( & mut self , dest : & mut [ u8 ] ) -> Result < ( ) , rand:: Error > {
208
- Ok ( self . fill_bytes ( dest) )
208
+ self . fill_bytes ( dest) ;
209
+ Ok ( ( ) )
209
210
}
210
211
}
You can’t perform that action at this time.
0 commit comments