Search the Community
Showing results for tags 'number'.
-
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