Search the Community
Showing results for tags 'prng'.
-
The Normal PRNG: class pkmgen4prng(object): def __init__(self,seed): self.seed =(seed * 0x41C64E6D + 0x6073) if self._bitLen(self.seed)>32: self.seed = self.seed>>self._bitLen(self.seed)-32 object.__init__(self) def prngenerate16(self): seed = self.seed self.seed = (self.seed * 0x41C64E6D + 0x6073) if self._bitLen(self.seed)>32: self.seed = self.seed>>self._bitLen(self.seed)-32 return seed>>self._bitLen(seed)-16 def prngenerate32(self): firstrandom16 = self.prngenerate16() secondrandom16 = self.prngenerate16() return ((firstrandom16<<16)|secondrandom16) def _bitLen(self,int_type): length = 0 while (int_type): int_type >>= 1 length += 1 return(length) The GTS PRNG: class pkmgen4gtsprng(object): def __init__(self,seed): self.seed =(seed * 0x45 + 0x1111) if self._bitLen(self.seed)>31: self.seed = self.seed>>self._bitLen(self.seed)-31 object.__init__(self) def prngenerate16(self): seed = self.seed self.seed = (self.seed * 0x41C64E6D + 0x6073) if self._bitLen(self.seed)>31: self.seed = self.seed>>self._bitLen(self.seed)-31 return seed>>self._bitLen(seed)-16 def prngenerate32(self): firstrandom16 = self.prngenerate16() secondrandom16 = self.prngenerate16() return ((firstrandom16<<16)|secondrandom16) def _bitLen(self,int_type): length = 0 while (int_type): int_type >>= 1 length += 1 return(length) Credits: LexyEvee/Evee (veekun.com) - for helping me fix my code and providing the gts prng constants
-
I've been looking over the guides and talking with some people. I'm concerned about how they can tell which formula the Pokemon was generated with. From what I know, certain formulae (Wild NDS, Common GBA etc), toss out results from the PRNG. If it tosses out two or three, how do you know? The value isn't stored anywhere, it's just a garbage value. Could someone help explain this to me? I understand the coding behind it, just not how I'm supposed to apply the PRNG to get results. Like how Pokemon X is from formula Z.
-
I'm only using this for personal use, just to calculate things.. but I need some help.. I use VisualStudio 2005 first, i used VB Private Function PRNG(ByVal seed As String) As String Dim temp As String = "" Dim t As UInt64 t = Convert.ToUInt64("0x41C64E6D", 16) * Convert.ToUInt64(seed, 16) + Convert.ToUInt64("0x6073", 16) temp = Hex(t) If temp.Length < 16 Then For t = 0 To 15 - temp.Length Step 1 'just to add zero temp = "0" & temp Next End If PRNG = temp End Function then for some reason i have to convert it to C#, here is the code: using Microsoft.VisualBasic; //for Conversion private const UInt64 factor = 0x41C64E6D; private const UInt64 adder = 0x6073; //... private string generate(String seed) { return temp = Conversion.Hex( (factor * Convert.ToUInt64(seed, 16) + adder)); } but i get different result, well the LSB is the same, but the MSB is different.. any clue? :bidoof::bidoof::bidoof: thx a lot
-
I only just found this out. Apparently this has been going on at Smogon for a while. A quick skim of the article reveals the various mechanisms that seed the PRNG (DS system time, etc.) and how to exploit them to get flawless/shiny Pokemon. http://www.smogon.com/forums/showthread.php?t=52180 SCV's article and code are credited. [Edit by evandixon] Smogon recently changed their forum system. Here's the new link (thanks to LEGOanimal22 for the link): http://smogon.com/forums/threads/rng-research.61090/