Browse Source

Merge #577

577: rand: fix overflow (issue #576) r=Dirbaio a=thibautvdv

Fixes #576 

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
bors[bot] 3 years ago
parent
commit
de109858ca
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/rand.rs

+ 1 - 1
src/rand.rs

@@ -17,7 +17,7 @@ impl Rand {
         const M: u64 = 0xbb2efcec3c39611d;
         const A: u64 = 0x7590ef39;
 
-        let s = self.state * M + A;
+        let s = self.state.wrapping_mul(M).wrapping_add(A);
         self.state = s;
 
         let shift = 29 - (s >> 61);