Improbable TrainerID/SecretID-combinations
Hi there,
Just found out some things and thought I should share them.
Seedsetting at start of game:
1. Before intro comes up, Seed is set to timedate (x1). This has an offset of zero,
so last byte is year.
2. Then it is set to zero
2.1 At this point, 18 random numbers are created.
2.1 of course, with seed being zero, those are not really random
3. When switching to title screen, it is set to x1, again
4. After pressing "continue", it is seeded with new (current timedate)
---
At the beginning of the game (starting new game),
1. Before intro comes up, Seed is set to timedate (x1)
2. Then zero
3. then to x1, again
4. Before Prof speech comes up, seed is set to current timedate
5. After TV Scene, a new (current) timedate is put into seed
5.1 this has a rather high offset (hat 2838 for Year 2009) as prof speech takes some time.
6. Mersenne Twister is called twice. The second roll gives the Trainer IDs.
(low 16Bit is public ID, high 16 Bit is hidden ID)
7. Three calls to RNG are made afterwards, these seem used to set the pointers
---
The most interesting thing about this is (6). A given seed will always result in the same TrainerID/SecretID-combination.
This throws up a question: Can I hit _every_ number? As this maps 2^32 (seeds) onto 2^32 (possible rolls), two seeds resulting in the same roll would mean that some other number can't be hit - therefore making a specific trainerID/secretID-combination _invalid_.
I know that Mersenne is better RNG than the other one, but is it possible to calculate back from a roll to the seed, given that you know it's the second roll? Is it easily possible?
I answered another question myself: It seems like _every_ seed is possible at the beginning of the game. Given a large delay, you can change the seed as if the game was started in another hour.
Still that means that someone with a TrainerID/SecretID resulting from a Seed xxFFxxxx or even xx00xxxx spent an enormous amount of time listening to the professor at the beginning of the game - thus making these TrainerID/SecretID-combinations rather "unprobable". I waited about 20 minutes just to have the "hour digit" by a single digit. Given that it is 23 =0x17 at max, offsetting it to FF would mean a waittime of 4640 minutes.
I gotta admit, I did this on emulator so timing might be wrong but if offset is "seconds*60", this still means about 18.2 minutes per digit.
So my main question to the math geniuses is: Can I rollback the second Mersenne roll to the original seed? Or do I have to create a map by bruteforce?
Greetings,
TCC