- Thread starter mingot
- Start date

It's been said that this ARNG (in your linked material) generates the PID for wonder card pokemon. I wonder if that's really the case, now, or is it _only_ using this routine for PID modification to un-shiny them, when in fact, there was some earlier method used to create the initial PID. What makes me think it could be is that the IRNG actually uses this routine when you have parents from different regions in daycare to modify the PID (up to 3 times) to increase the chance of it being shiny.

Here is a video which shows the mystery gift algorithm in action: http://rapidshare.com/files/173485208/MG.avi

and an explanation: http://www.pokecommunity.com/showthread.php?t=163030

And any idea what puts the values into the two locations given that lead to their seeding or the ARNG?

If those numbers could, in any way, be correlated back to the initial seed that LCRNG and IRNG use then it might actually be possible to do a soft hack check on them.

If those numbers could, in any way, be correlated back to the initial seed that LCRNG and IRNG use then it might actually be possible to do a soft hack check on them.

What should I fill in here?

http://img24.imageshack.us/img24/5415/aufzeichnenvcv.jpg

This box confuses me :s

the Jonny2Code has at least 2 mistakes: an | must be replaced with a + and a & with a xor somewhere but I don't remember where...time has passed :D.

also my own generator now outputs the same numbers as mingot's does. Decided to go for C++ because the STL-Map seems rather nice for it - also my other pokemon-related-tools were written in C++

Code:

```
typedef map<uint32_t,uint32_t> t_mersenneTable;
t_mersenneTable createInitialMTable(uint32_t seed){
t_mersenneTable myTable;
{ // insert seed
pair <uint32_t,uint32_t> myEntry;
myEntry.first=0;
myEntry.second=seed;
myTable.insert(myEntry);
}
uint16_t tableIndex;
map<uint32_t,uint32_t>::iterator lastPos=myTable.begin();
for (tableIndex=1;tableIndex<=623;tableIndex++){
pair <uint32_t,uint32_t> myEntry;
myEntry.first=tableIndex;
myEntry.second=((lastPos->second / (1<<30)) xor lastPos->second) *0x6C078965 + tableIndex;
myTable.insert(lastPos,myEntry);
lastPos++; // advance iterator
}
//t[n] = (( upper 2bits of t [n-1] ) xor t [n-1]) * 0x6c078965 + n
return myTable;
}
uint32_t getPreRandom(t_mersenneTable* currentTable){
uint32_t currentIndex=currentTable->rbegin()->first+1;
uint32_t temp_h=0;
uint32_t randomNumber;
temp_h = temp_h + ((*currentTable)[currentIndex-624] & 0x80000000); // front bit
temp_h = temp_h + ((*currentTable)[currentIndex-624+1] & 0x7FFFFFFF); // back
// temp_h is equivalent to k[0]
randomNumber=(*currentTable)[currentIndex-227] xor (temp_h / 2)
xor ((temp_h % 2) * 0x9908B0DF);
// last xor only useful if temp_h is even.
{ // insert into table
pair <uint32_t,uint32_t> myEntry;
myEntry.first=currentIndex;
myEntry.second=randomNumber;
currentTable->insert(myEntry);
}
return randomNumber;
}
uint32_t temper(uint32_t randomNumber){
uint32_t temp;
temp = randomNumber;
temp = temp xor ((temp >> 11)); // (equivalent to ( / 0x800)
temp = temp xor ((temp << 7) & 0x9D2C5680); // equivalent to ( * 0x80)
temp = temp xor ((temp << 15) & 0xEFC60000); // equivalent to ( * 0x8000)
temp = temp xor ((temp >> 18));
return temp;
}
```

@mingot: Thanks for posting the example code. I really helped finding the flaws in my stuff.

TCC

I managed to lock myself on a Shiny-Adamant-Technician-Scyther-egg after only 300+ taps and 9 coin flips :D

Now if only the RNG that generates the IVs of eggs was figured out too this would be a breeze but for now I'm SRing the good old fashioned way as always.

Thanks to everyone that make this possible.