We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57f4dc1 commit ca61f05Copy full SHA for ca61f05
tests/src/rng.rs
@@ -4,14 +4,29 @@ use std::collections::HashSet;
4
pub fn test() {
5
assert_eq!(
6
seeds(),
7
- include_str!("./rng_seeds.txt")
8
- .trim()
9
- .split('\n')
10
- .map(|s| s.trim().parse::<u16>().expect(s))
11
- .collect::<HashSet<_>>()
+ seeds_impl(),
12
);
13
}
14
+pub fn seeds_impl() -> HashSet<u16> {
+ let mut seeds: HashSet<u16> = HashSet::new();
+
+ let mut seed = 0x8988;
15
16
+ loop {
17
+ seeds.insert(seed);
18
19
+ let new_bit = ((seed >> 9) ^ (seed >> 1)) & 1;
20
+ seed = (new_bit << 15) | (seed >> 1);
21
22
+ if seed == 0x8988 {
23
+ break;
24
+ }
25
26
27
+ seeds
28
+}
29
30
pub fn seeds() -> HashSet<u16> {
31
let mut emu = util::emulator(None);
32
let rng_seed = labels::get("rng_seed");
0 commit comments