public static List <uint> GeneratePIDFromIV(ushort hp, ushort att, ushort def, ushort spatt, ushort spdef, ushort spe) { do { PokePRNG rand; uint ivs = (uint)(hp + (att << 5) + (def << 10) + (spe << 15) + (spatt << 20) + (spdef << 25)); uint iv1 = (ivs & 0xFFFF) % 0x8000; uint iv2 = (ivs >> 0xF); uint check = (iv2 << 16); List <uint> pids = new List <uint>(); for (uint i = 0; i < 65535; i++) { uint X4 = check + i; rand = new PokePRNG(X4); uint X3 = rand.PreviousNum(); if ((X3 >> 16) == iv1) { uint X2 = rand.PreviousNum(); uint X1 = rand.PreviousNum(); pids.Add((X1 >> 16) + (X2 & 0xFFFF0000)); } } return(pids); } while(true); }