summaryrefslogtreecommitdiffstats
path: root/src/rand.rs
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-01-15 09:36:15 -0800
committerRose Hogenson <rosehogenson@posteo.net>2024-01-15 09:36:15 -0800
commit3603d42087fa9399fa7f3730a0d3c7c714d6dccc (patch)
treeda6ea53261f52ba754a21c3b5e2590ca633207fb /src/rand.rs
parentWrite a simple snake game. (diff)
downloadsnake-3603d42087fa9399fa7f3730a0d3c7c714d6dccc.tar.zst
Clean up and simplify the code.
Diffstat (limited to 'src/rand.rs')
-rw-r--r--src/rand.rs17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/rand.rs b/src/rand.rs
deleted file mode 100644
index f9aee46..0000000
--- a/src/rand.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-pub struct Gen {
- state: i64,
-}
-
-
-pub fn new(seed: i64) -> Gen {
- Gen{
- state: seed,
- }
-}
-
-impl Gen {
- pub fn rand(&mut self, max: i32) -> i32 {
- self.state = self.state.wrapping_mul(6364136223846793005).wrapping_add(1);
- (self.state >> 33 & 0x7fffffff) as i32 % max
- }
-}