summaryrefslogtreecommitdiff
path: root/2026/games/asrael_io/source/src/rng.rs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2026-08-26 23:47:59 -0400
committerLLLL Colonq <llll@colonq>2026-08-26 23:47:59 -0400
commit0d2d8cd897e94bd94e0b3ae7c6ce9aa580a44a0a (patch)
treee9039d1c3aedca515d6cb499451d4b73aca4f5fd /2026/games/asrael_io/source/src/rng.rs
parent242943e5b023ce40eb3be826c418a478d4672f78 (diff)
Add a_tension_span
Diffstat (limited to '2026/games/asrael_io/source/src/rng.rs')
-rw-r--r--2026/games/asrael_io/source/src/rng.rs35
1 files changed, 0 insertions, 35 deletions
diff --git a/2026/games/asrael_io/source/src/rng.rs b/2026/games/asrael_io/source/src/rng.rs
deleted file mode 100644
index 6e46de0..0000000
--- a/2026/games/asrael_io/source/src/rng.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-pub struct Rng(u32);
-
-impl Rng {
- pub fn new(seed: u32) -> Self {
- let mut rng = Self(seed.max(1));
- rng.next();
- rng
- }
-
- pub fn next(&mut self) -> u32 {
- self.0 ^= self.0 << 13;
- self.0 ^= self.0 >> 17;
- self.0 ^= self.0 << 5;
-
- self.0
- }
-
- pub fn range(&mut self, n: u32) -> u32 {
- self.next() % n
- }
-
- pub fn f32(&mut self) -> f32 {
- self.next() as f32 / u32::MAX as f32
- }
-
- pub fn chance(&mut self, p: f32) -> bool {
- self.f32() < p
- }
-}
-
-impl Default for Rng {
- fn default() -> Self {
- Self::new(u32::from_be_bytes(*b"CLNK"))
- }
-}