Mercurial > touhou
comparison utils/src/prng.rs @ 795:2d60a14f4816 default tip
python: Rewrite the main entrypoint in Rust
This lets us progressively replace Python modules with Rust ones.
Currently missing features include:
- Saving replays
- Networking code for cooperative mode
- Reading a configuration file for options
- Maybe more.
But the base game is working, so yay!
| author | Link Mauve <linkmauve@linkmauve.fr> |
|---|---|
| date | Tue, 02 Jun 2026 19:06:16 +0200 |
| parents | 1f152ca95658 |
| children |
comparison
equal
deleted
inserted
replaced
| 794:8c2ef2d503c9 | 795:2d60a14f4816 |
|---|---|
| 12 // TODO: Maybe add a getrandom::u16() to getrandom instead? | 12 // TODO: Maybe add a getrandom::u16() to getrandom instead? |
| 13 let seed = seed.unwrap_or_else(|| getrandom::u32().unwrap() as u16); | 13 let seed = seed.unwrap_or_else(|| getrandom::u32().unwrap() as u16); |
| 14 Prng { | 14 Prng { |
| 15 seed, | 15 seed, |
| 16 } | 16 } |
| 17 } | |
| 18 | |
| 19 /// Returns the current seed. | |
| 20 pub fn get_seed(&self) -> u16 { | |
| 21 self.seed | |
| 17 } | 22 } |
| 18 | 23 |
| 19 /// Generates a pseudo-random u16. | 24 /// Generates a pseudo-random u16. |
| 20 /// | 25 /// |
| 21 /// RE’d from 102h.exe@0x41e780 | 26 /// RE’d from 102h.exe@0x41e780 |
