Refactor code based on clippy suggestions

This commit is contained in:
2022-08-25 17:45:16 -04:00
parent 9a9b5335f1
commit b97b2fe6d0
16 changed files with 145 additions and 204 deletions

View File

@@ -40,10 +40,10 @@ impl MT19937 {
}
pub fn extract_number(&mut self) -> u32 {
if self.index == N {
self.twist();
} else if self.index > N {
panic!("Generator was never seeded");
match self.index.cmp(&N) {
std::cmp::Ordering::Equal => self.twist(),
std::cmp::Ordering::Greater => panic!("Generator was never seeded"),
std::cmp::Ordering::Less => (),
}
const S: u32 = 7;