1. New to the forums? Check out our Mentorship Program!
    Our mentors will answer your questions and help you become a part of the community!
  2. Welcome to Smogon Forums! Please take a minute to read the rules.
  3. Welcome to Wi-Fi! Please remember to read the rules and do NOT create a new thread for simple trades or Friend Safari codes.

Most Generation PRNG Help / Information

Discussion in 'Wi-Fi' started by mingot, Mar 16, 2009.

  1. ayush is cool

    ayush is cool

    Joined:
    Jan 30, 2009
    Messages:
    385
    ok i fixed that.
    anyways lets a say i caught a pokemon with sweet scent and now want to check the IV's. so do i have to have an AR or how can i check them?
  2. Toothache

    Toothache Let the music play!
    is a Forum Moderator Alumnus

    Joined:
    Dec 27, 2004
    Messages:
    3,730
    Use the simple questions thread for questions like this. Thanks.
  3. hrc969

    hrc969

    Joined:
    Jul 24, 2007
    Messages:
    58
    As the info says the seed for the mystery gift pokemon is made from the two locations given (16 bits each) then the ARNG is used exclusively.

    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
  4. mingot

    mingot free agent
    is a Site Staff Alumnusis a Battle Server Admin Alumnusis a Researcher Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus

    Joined:
    Jun 15, 2008
    Messages:
    3,050
    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.
  5. hrc969

    hrc969

    Joined:
    Jul 24, 2007
    Messages:
    58
    This might be a possibilty. I'll let SCV know and see what he can find about the IRNG. Would he be able to find everything he needs to find it in the RAM in this thread?
  6. mingot

    mingot free agent
    is a Site Staff Alumnusis a Battle Server Admin Alumnusis a Researcher Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus

    Joined:
    Jun 15, 2008
    Messages:
    3,050
    He'll probably want the magic numbers for MT, which is at least linked. I spoke with him a bit ago and he put me right on the wondercards. :)
  7. Dark-Ryu

    Dark-Ryu Spammer

    Joined:
    Mar 12, 2008
    Messages:
    8,787
    So I have to follow the same steps for D/P o.o?
    It doesn't change anything?
  8. mingot

    mingot free agent
    is a Site Staff Alumnusis a Battle Server Admin Alumnusis a Researcher Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus

    Joined:
    Jun 15, 2008
    Messages:
    3,050
    Yes, same steps. No it does not change anything.
  9. Dark-Ryu

    Dark-Ryu Spammer

    Joined:
    Mar 12, 2008
    Messages:
    8,787
    Alright, thank you Mingot.
    So it doesn't matter if I hit the option of "Plat Egg PID (normal)" Right?
    Thanks for the awesome program =)
  10. mingot

    mingot free agent
    is a Site Staff Alumnusis a Battle Server Admin Alumnusis a Researcher Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus

    Joined:
    Jun 15, 2008
    Messages:
    3,050
    Thats the one you want to choose. The next version renames all options to DPPt, but it is not out yet. Thanks :)
  11. Massi

    Massi

    Joined:
    Jan 15, 2008
    Messages:
    1,361
  12. The Mole

    The Mole

    Joined:
    Jul 9, 2008
    Messages:
    2,087
    You don't need to fill anything in there :)
  13. mingot

    mingot free agent
    is a Site Staff Alumnusis a Battle Server Admin Alumnusis a Researcher Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus

    Joined:
    Jun 15, 2008
    Messages:
    3,050
    Nothing at all. Don't over think the directions, just follow them.
  14. Massi

    Massi

    Joined:
    Jan 15, 2008
    Messages:
    1,361
    Ok, thanks =) I will just try it on D/P.. Hope it will work
  15. Justice_X

    Justice_X

    Joined:
    Jul 16, 2007
    Messages:
    123
    This is all so confusing to me. ?_? Can someone please tell me what RNG stands for before I start to try to comprehend how all of this works? And can someone please give me link to threads that include information that'll be useful to me?
  16. thetorsoboy

    thetorsoboy

    Joined:
    Mar 15, 2008
    Messages:
    2,304
    Really?

    Check the first page of this thread, okay?
  17. TCCPhreak

    TCCPhreak

    Joined:
    Mar 1, 2009
    Messages:
    23
    Found them - the hard way. ;-)

    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;
    }
    
    now I just need to put it into a class file on its own, write some nice command-line-interface... but the main work is done.

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

    TCC
  18. Justice_X

    Justice_X

    Joined:
    Jul 16, 2007
    Messages:
    123
    Is there any way to do any of this without a Pokesav or another cheat device? How about for non-bred Pokemon?
  19. Justice_X

    Justice_X

    Joined:
    Jul 16, 2007
    Messages:
    123
    In order to breed shinies using this method do you need to check your Secret ID?

    Also, what does PID stand for?
  20. mingot

    mingot free agent
    is a Site Staff Alumnusis a Battle Server Admin Alumnusis a Researcher Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus

    Joined:
    Jun 15, 2008
    Messages:
    3,050
    Actually if you have a shiny pokemon that you have caught, not including chained pokemon, you can find your SID without any hacking device.

    @ TCC It looks very nice and clean :)
  21. Miltonic

    Miltonic

    Joined:
    Mar 20, 2007
    Messages:
    1,661
    after lots of procrastination I finally gave a shot at this with my Pearl gme and finally got the bold female shiny feebas I always wanted on my second try. :)
  22. Lightsabre

    Lightsabre

    Joined:
    Aug 1, 2008
    Messages:
    1,958
    my bro just missed barely. I'm working on a longer tapping spree of 789. much better then the orriginal one I was going for(5989)
  23. OmegaX

    OmegaX

    Joined:
    Nov 25, 2007
    Messages:
    1,989
    It has been a LONG time since I bred anything but as soon as I read that this was possible to do on D/P I had to try it.
    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.
  24. mingot

    mingot free agent
    is a Site Staff Alumnusis a Battle Server Admin Alumnusis a Researcher Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus

    Joined:
    Jun 15, 2008
    Messages:
    3,050
    It's been figured out, just waiting on documentation and new software (which is really done now so just documentation). Warning -- It's not like Emerald and it WILL test your patience and sanity. Some with good parents will likely opt to continue the old fashioned way.
  25. Lightsabre

    Lightsabre

    Joined:
    Aug 1, 2008
    Messages:
    1,958
    my brother just did 316 taps, and 5 coin flips, just like the app said. but he didn't get a shiny sheildon like he was breeding for. what's the cause?

Users Viewing Thread (Users: 0, Guests: 0)