mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Add new_with_seed method
This commit is contained in:
parent
610722a1bf
commit
3c52f6940b
|
@ -15,6 +15,10 @@ impl RandomNumberGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
pub const fn new_with_seed(seed: [u32; 4]) -> Self {
|
||||
Self { state: seed }
|
||||
}
|
||||
|
||||
pub fn next(&mut self) -> i32 {
|
||||
let result = (self.state[0].wrapping_add(self.state[3]))
|
||||
.rotate_left(7)
|
||||
|
|
Loading…
Reference in a new issue