ILOVEPIE Posted November 29, 2011 Posted November 29, 2011 (edited) 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 Edited November 29, 2011 by ILOVEPIE No user evee
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now